Hi! We've been developing a large application using EF, until recently, where the problems we have with EF made us to do a research on a better ORM. The best one we come up with is yours, lots of features, lots of thinking on better approaches and ...

One problem I faced while reading the help file is that it seems you do not allow to have the actual foreign key in the entity class, for instance, if I have an Entity "Order" which in database has a column Named CustomerID, this whill appear in DO.Net as having a property of type Customer. I also need the CustomerID, on Order itself. This is vital for our application framework to work correctly.

Can I do this using DO.Net?

asked Jul 07 '12 at 03:38

Alireza's gravatar image


One Answer:

Hello Alireza,

you can add non-persistent property with special getter that does the job:

public long CustomerId
    return GetReferenceKey(TypeInfo.Fields["Customer"]).Value.GetValue<long>(0);

answered Jul 09 '12 at 06:10

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Jul 07 '12 at 03:38

Seen: 2,723 times

Last updated: Jul 09 '12 at 06:10

powered by OSQA