product.Category = session.Load<Category>(theId);
2009/11/8 Mohamed Meligy <[email protected]> > Let's say I have a mapping like this (using Fluent, sample made up for the > sake of the email) > > References(product => product.Category, "CategoryID"); > > where each One Category has zero to Many Products. > > Lets say I need to set the value of the Category.Id of the Product directly > without loading the Category object. I thought I could do something like: > > product.Category.Id = int.Parse(ddlCategory.SelectedValue); > > (Code is OVER simplified for demoing here, yes, I have layering in my > application :)). > > Someone told me the proxy handles getting the value for > product.Category.Id (if exists) without loading the category, so, I > thought it may work when I SET the Id, but what happened is that it gave a > NullReferenceException (makes sense of course). > > So, I was asking, is there another way of doing this ?? (whether or not it > is a right idea to do it at all please) > > > Thank you very much. > > Regards, > > -- > Mohamed Meligy > Senior Developer, Team Lead Backup (.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: [email protected] > Weblog: http://weblogs.asp.net/meligy > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
