How to implement CRUD operations for complex objects?
My name is Fernando López Guevara, I'm from Argentina.
Sorry for my English. It's not so good =)
I was reading the code of the Design Pattern Framework 4 and noticed that it shows how to implement CRUD operations for a single entity like Customer. I was wondering how to write CRUD operations with complex objects, for example Order with several OrderDetails; This should include the Unit of Work pattern. Correct?
I hope you understand my question'
Thanks and cheers.
Fernando López Guevara, Sep 29, 2010
You can use NHibernate for crud operation :)
Raj Bose, Feb 01, 2011
Use LINQ Managed Entity.At first you might scratch your head once this phase pass by it will be very easy to manage
Mohammed Sarfaraz, Jan 23, 2011
Actually, the Pattern Framework 3.5 already included ASP.NET MVC. So there was MVC used for the ASP.NET presentation layer, MVP for the WinForm presentation layer and MVVM for the WPF presentation layer. The Pattern Framework 4.0 however features ASP.NET MVC 2.0. I hope, I am not mistaken,... ;-)
Aug 17, 2010
The answer really depends on your data infrastructure.
If you are using the Entity Framework 4, it was built-in ways of updating relational data when the parent data is updated. If you are using straight ADO.NET, then you simply have to write functions to collect the related OrderDetails for the Order and loop through each detail and update for that Order.
And yes, you can use the Unit of Work pattern. But it mostly depends on how your data layer is built. Is it already using an ORM like EF4 or Linq-To-Sql, etc., or is it completely hand coded with ADO.NET? Those are the determining factors.
I hope that helps.
King Wilder, Nov 03, 2010