We’re looking to create an API that will wrap all internal interactions between our model and repositories and provide a simplistic way to add and update entities within the system.
I’m looking along the lines of the consumers of this API to be able to go:
SystemOder order = SomeClass.GetSystemOrderById("...");
order.amount = 200;
order.InvoiceAddress[0].StreetName = "123 Fake Street";
order.Save();
Now behind the scenes we still a model to repository architecture but for writing pure business logic this would sit on top of and hide it from end consumers. Are there any decent patterns for this kind of architecture?
Just to clarify we obviously don’t want to bake in Save() methods into or core domain model or anything like that we just want a nice API to strip out needless code resolving collections and calling repositories etc.
Going to roll my own facade pattern that will encapsulate the object model and the persistence mechanisms of Save() Delete etc while still maintaining a good seperation of model/DAL. It’s the type of thing mixins would be extremely useful for…ohh well.