Get Nhibernate entity and complete it from a web service.
- by Nour Sabouny
Hi every one.
let's say that i have an order system.
each "Order" references a "Customer" Object.
when i fill the orders list in Data Access Layer, the customer object should be brought from
a Customer Web Service "WCF".
so i didn't map the Customer property in the Order mapping class,
Id(o => o.OrderID).GeneratedBy.Identity();
//References(o => o.Customer).Not.Nullable().Column("CustomerID");
HasMany(o => o.Details).KeyColumn("OrderID").Cascade.AllDeleteOrphan();
Map(c => c.CustomerID).Not.Nullable();
and asked the nhibernate session to get me the orders list.
and tried to loop on every order in the list to fill it's customer property,
doe's any body have a good idea for this ????
IList<Order> lst = Session.CreateCriteria<Order>().List<Order>();
foreach (Order order in lst)
order.Customer = serviceProxy.GetCustomerByID(order.CustomerID);