When doing some optimization with my data model and repository using NUnit, I noticed my one-to-one tables, which consist of three: User.cs, UserAccount.cs, UserProfile.cs, being all selected even though I do not fill the other tables or asked for those columns on the other table.
I know I can put it all in one table (class), but the eager loading and lazy loading does not always activate and when dealing a lot of columns of data in the code and on the database itself. Thus, it gets too much without knowing. I read a lot of articles from Google searching solutions on NHibernate or Castle ActiveRecord dealing with OneToOne (one-to-one mapping, relationship). Even though, I read about one major workaround is using many-to-one, which REALLY leaves a bad taste in my data model (more like a hack solution, to get a fake one-to-one to lazy load or eager load). Ideal Solution (which I originally implemented this way): http://www.castleproject.org/activerecord/documentation/trunk/usersguide/relations/onetoone.html I tried this solution with my ActiveRecord, but it failed like on INSERT and DELETE. http://gnschenker.blogspot.com/2007/06/one-to-one-mapping-and-lazy-loading.html I went far with my ActiveRecord until it felt like more of a hack, then I retreated: http://ayende.com/Blog/archive/2009/04/19/nhibernate-mapping-ltone-to-onegt.aspx In conclusion, NHibernate is awesome and I highly appreciate it. If I had one wish for NHibernate/ActiveRecord/Linq as a whole, my ultimate wish is to get eagar load and lazy load to work with OneToOne (one-to- one mapping). Please. Specs: ASP.NET 3.5 SP1 MVC 1.0 MySQL 5.0.24a MySQL Connector/Net 6.1.1 NHibernate 2.1.0.GA NHibernate.Linq 1.0.0.GA Castle ActiveRecord 2.0 Sincerely, William Chang http://www.williamchang.org http://www.babybluebox.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
