If I'm not mistaken, just accessing the Id property of an entity that's lazy loaded, does not force a loading of that entity. The proxy has the Id on it, it's how it knows about which entity to go and get it whenever it's being lazy initialized.
I could set up a simple test to verify though, but I'm pretty sure that's how it works. On Tue, Oct 27, 2009 at 11:06 AM, Mohamed Meligy <eng.mel...@gmail.com>wrote: > Well, what if this is exactly what I want to avoid? What I want to avoid > loading the entity (no need in my scenario most of the time I'll just be > setting or reading only the key). Say ibn the UI for editing screen I have > drop down menu with all OtherEntity objects and I want to just compare IDs > to select the right drop down menu item and when the form is posted back to > save the editing I just want to assign the value in this dropdown??? > (Well, this is not the only scenario I have but to demonstrate). > > > Regards, > > -- > Mohamed Meligy > Information Analyst (.Net Technologies) – Applications Delivery - TDG > Injazat Data Systems > P.O. Box: 8230 Abu Dhabi, UAE. > > Phone: +971 2 6992700 > Direct: +971 2 4045385 > Mobile: +971 50 2623624, +971 55 2017 621 > > E-mail: eng.mel...@gmail.com > Weblog: http://weblogs.asp.net/meligy > > > On Tue, Oct 27, 2009 at 6:02 PM, Hudson Akridge > <hudson.akri...@gmail.com>wrote: > >> Well, there's no need for the RelatedEntityId to also be a property in the >> Entity class. Because the RelatedEntity class should have it's own ID (say >> you call it RelatedEntityId as a property in that classes mapping). So you >> should be able to retrieve an Entity, and do >> Entity.RelatedEntity.RelatedEntityId. >> >> >> On Tue, Oct 27, 2009 at 3:58 AM, Mohamed Meligy <eng.mel...@gmail.com>wrote: >> >>> Hello, >>> Let's say I want to have many-to-one relation like: >>> >>> public class Entity >>>> { >>>> public long EntityId {get;set;} >>>> public long RelatedEntityId {get;set;} >>>> public OtherEntity RelatedEntity {get;set;} >>>> } >>>> >>> >>> The reason I want to have RelatedEntityId is because, in my scenario, I >>> expect to need ONLY the ID of the other entity withough needing to load it >>> at all. >>> >>> Can I do that? >>> >>> Thank you. >>> Regards, >>> >>> -- >>> Mohamed Meligy >>> Information Analyst (.Net Technologies) – Applications Delivery - TDG >>> Injazat Data Systems >>> P.O. Box: 8230 Abu Dhabi, UAE. >>> >>> Phone: +971 2 6992700 >>> Direct: +971 2 4045385 >>> Mobile: +971 50 2623624, +971 55 2017 621 >>> >>> E-mail: eng.mel...@gmail.com >>> Weblog: http://weblogs.asp.net/meligy >>> >>> >>> >> >> >> -- >> - Hudson >> http://www.bestguesstheory.com >> http://twitter.com/HudsonAkridge >> >> >> > > > > -- - Hudson http://www.bestguesstheory.com http://twitter.com/HudsonAkridge --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---