ParentId and Parent type in Entity Framework -


I have many organizations (customer, prospects, ...)

I have a name The unit, which can handle the notes for customers, the possibilities ... Notes table occurs: ID Parent_IID Pantrotype Note

How to manage it with unit framework?

Thanks John

Do not do that.

If you are completely convinced that all the notes are the same as the abstract data type, even if they can be owned / used by different datasets, the sub type of note for each owner / user type can do.

These four things are: If the requirement creates creep, then it allows you to hatch an escape, for example, at the end of the separation of the customer notes compared to the prospect notes, you (or unit Framework ORM) for writing ugly SQL, allows you to use general contextual integrity barriers in the database, and allow you to use good type of deficits in the net Yes.

Actually:

In the database:

Make a table note (any type of favored synthetic key, notified text); Table customer_note (any type of id favored synthetic key, customer_ id not Intel no null reference customer (id), note_ id not empty reference note (id) - add creep customer note attribute data);

Pure:

Zero Client :: addNote (customer note and note) {// typing prevents a customer from adding a prospect note ...} < / P>

(Here's just a 'problem': When a prospect changes into a customer, then you have a converted constructor that tells the change, which in the end will remove rows from the table Prospect_note and Customer_not.Or, in this inefficient way, Scanning will do, but you will be able to override it and if you have to write an archived work or preference, you will be able to do it efficiently.)


Comments