Hi I am creating an ASP.NET application which references a Class Library (My Data Layer). The ASPX pages just call various methods on the DataLayer objects and retrieve DataSets to retrieve data and execute queries to save data.
Now I have to save an Order along with OrderLineItems in the database. I have an Order class defined in ASP.NET project which has a strongly typed collection of OrderLineItems in it. I want to save this order object in the database within a transaction. Saving the OrderHeader in OrderHeaders table will give me the OrderHeaderID which I will use to save the OrderLineItems in OrderLineItems table. Everything works so far, now what I want is that without writing any database access code in ASPX pages - I simply pass the Order object to the DataLayer and call a save method. The DataLayer will be responsible for creating a new transaction and saving the data. The question is - how to pass the Order object to the DataLayer. Since the DataLayer project is not referencing the ASP.NET project - it does not have any information about the public types exposed by ASP.NET project, so I cannot create a method in DataLayer which accepts an Order class e.g. Public Function SaveOrderWithLineItems(ByVal thisOrder as Order) as Boolean. Does that mean I will have to create a dummy class in the DataLayer project called Order along with the OrderLineItems collection? In that case I could serialize the ASPXProject.Order object and pass it to the DataLayer and desterilize it into DataLayer.Order object. Will that work? May be Remoting or EnterpriseServices has a solution to this - but the project is not really complex enough to implement these .NET features in this scenario. Please suggest any alternative designs if possible. Thanks P.S: Sorry for cross-posting. I need a solution urgently You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
