Hi all,
This question is sort of a pool. We are trying to identify the best archtecture while using a ORM like LINQ to SQL. The archture we are defining is for sort of framework that other applications will access either trough directly referencing the DLL or through a webservice. We have .NET apps and PHP apps.
The possibilities are:
Multiple data contexts: Separting the database into units of work and create separate contexts for each one.
Pros:
- Easy of use
- Classes will be broken into different namespaces
- Smaller domain to maintain
Cons:
- Objects have to be duplicated if related, creating maintenance hell
- Objects cannot be passed between context, creating the need for another hit on the data base
Single data context: All tables, views, procedures, reside in the same huge context.
Pros:
- No duplication
- Relationships are easy to manage, basicaly the LINQ takes care of it.
- Better performance, less hits on the DB.
Cons:
- All tables are in the same namespace, code completion becomes nuts
- Not the best for the designer (at least on VS2008)
- Cannot be selective in what to save and what not. Save all, or delete all mode.
Well this are things that came up to my mind, so if have any other pros or cons, please tell me and I will include them in the post. Also pick your best one.
Thanks all