Hi everyone
I'm working in a three tier asp.net/CSharp application and I'm having issues implementing the entity CRUD operations.
I'm using a custom reflection-based ORM for my data layer which maps table records from my database to the respective properties in the corresponding entity classes. My business layer currently is rather thin and is currently really a wrapper around the data layer.
My issue is, say, for example, I have an entity called Order which has the properties of OrderID, CustomerID, DateOrdered among other fields. The ORM has no issues mapping this entity to the respective Orders table within my database. However, in the presentation layer, it would likely be necessary to get the Customer entity which has the CustomerID of a given order. Could somebody give a recommendation whether I should keep this design and simply resolve the customer entity (where needed in the UI layer) by simply calling the business laying, passing in the order customer id - on the lines of:
CustomerBal.GetCustomerById(order.CustomerID)
Or, should I actually include the Customer entity as a property within the Order object? In this case, the entity would be resolved by lazy-loading a call to the business CustomerBal.GetCustomerById
... method. Or would the OrderBal business layer take care of making sub-calls to resolve the Customer by calling the CustomerBal.GetCustomerById
method? Or, would the OrderDal be responsible for resolving the Customer entity?
I'm getting myself into a little muddle trying to think of the best way to implement this. Any help or insight would be very much welcome.
Thanks, Carl