I have gone through the OpenAcess 101 & dis-connected API webinars.
I have looked at couple of examples from the knowledge base. The one that seems promising , Northwind WCF example :
ARCHITECTURE (ref: http://www.telerik.com/support/kb/orm/general/northwind-wcf-demo.aspx)
WCF Service assemblies:
ServiceContracts - Following the WCF practices there is an assembly which contains the service Contract INorthwindService. This is the contract that contains the endpoints for the service.
ServiceImplementation - This assembly contains the NorthwindService class which implements the INorthwindService interface.
ProviderContracts - The goal here is to loose couple the Service Implementation level from the BLL. To do this, we have a ProviderContracts assembly which contains a ProviderFactory. In doing so, using reflection, the BBL is loaded by simply stating the assembly name and class of the BLL provider to load which contains the endpoints which service the Service Implementation. The data provider assembly and class names are specified in the Web.config file of the service. This design allows us to have many data providers that can rely on completely different technologies but managing the same data. Nevertheless, only one provider can be used at the same time.
The Web.config file:
|<-- Telerik Open Access Provider --> <BR><add
|key="NWProviderAssembly" value="NSV.NW.OABLL"/> <BR><add
The ProviderContracts assembly also contains a Contract for the BLL to implement.
>>>>>>> So, as per my understanding, because of this indirection, there is the flexibility to chose any other data provider (another ORM or other data access technology) provided it implements the 'Provider Interface' (e.g. : INWProvider) which is an absolute requirement in the architecture for us.
DataContracts - In keeping the layers separated and also to have our own objects to pass through the service, we have a DataContract assembly. The data contracts contain the same fields as the database. There are different ways to do this but here we have assemblers that convert the DB objects to the data contracts. These assemblers take place in the BBL assembly as it is the highest level that manages the database objects.
>>>>>>> What are the suggested approaches for generating the data contracts. Is there an automated way as it might be a big overhead to manually create these classes?
Other questions :
- Could please clarify the purpose of the message contracts ?
- I got a little confused about the dis-connected API. If the proposed architecture (Northwind WCF Example) can work in a distributed environment, what is the need for the dis-connected API which seems to have the OpenAccess code in all the tiers (using ObjectContainers , ObjectScope, ChangeSets etc) ?
Thanks a lot.