I'm doing a little bit programming in C # and Java for a year and have a proper understanding of object-oriented programming, but my The new side project requires a database based model. I am using C # and Linux which is a very powerful tool, but I have trouble creating a database based on my object oriented approach.
My two main questions are:
How do I deal with heritage in my database? Assume I am building an employee rostering application and I have an abstract class, event. From the event I receive the Intact Class ShiftEvent and StaffEvent. Then I have a concrete class shift (derived from ShiftEvent) and staffing off (received from the staff event). There are other derivative classes, but this is enough for logic.
Do I need a separate table for shift events and staff events? Maybe I want a separate table for each concrete square? Both of these views believe that they will give me problems while interacting with the database. Another way might be an event table, and in this table, any of my concrete classes will have empty columns for all types of data. All these approaches believe that they can disrupt the expansion eligibility under the road.
How do I deal with one and a lot of relationships in one collection? Object Oriented Methods?
Let's say I have a product class and a category category. Each instance of categories will have one or more products, but the products themselves should not have any knowledge of categories. If I want to apply it to a database, then each product will need a category id that maps to the categories table. But it combines a pairing, which I like from the O.O. point. Products should not even know that categories are present, very few data fields have a category id! What is a better way?
LINQ to use a class per square solution:
Other solutions (Like my favorite, LLBL genes) allow other models privately, I like a table solution with a discriminating pillar, but it is probably possible because we often ask in the succession hierarchy and in this way, As you see, while asking a specific type of Only "where" change is needed for g
Everyone said and did, I personally think that oo mapping in the table is driving the car before the horse. Continuous claims for the solution of impedance mismatch between OLA and relations have been done ... and there are lots of OO specific databases, none of them are deprived of the powerful simplicity of relationships.
Instead, I design the database with the application in mind, map those tables into institutions and build from there. Some see it as a loss of OO in the design process, but to influence the design of a high level system in my mind, the data layer should not talk in your application adequately, just because you have a relational model Use for storage .
Comments
Post a Comment