I have a problem choosing architecture for my smart client application.
So far i have: Client: Winforms App (MVP for presentation, Service Layer, and EF4 for data acccess)
On server side i have: Windows Service ( same Service Layer, and Data Acccess as on client with little addons), WCF for some service operations and Sync Framework for syncing DBs on top of WCF
My main problem is Model in MVP, I can't figure out how to organize my Client model.
So here is example problem i need to solve in my App, and my thought on how to implement this:
The problem: We have a list of Business Object in database and we need to display this data in n-views where 1st view contains full list, 2nd contains part of this list based on some criteria, 3d on some other criteria, etc... so we have for example 3 Tabs
with DataGridView in each TabPage..
And of course user can add,delete,edit, this Business Objects.
I can't decide how to keep all this synced and working...
We have basically 2 options for syncing this:
1) We maintain full database object graph in Memory. For example in BindingList<T> or some custom collection manager (Repository or whatever) (+only one object reference in memory = less memory needed, fast! no DB read operations)
2) We use some kind of event aggregate and update(reload) view based on this events
3)We can have global static EF object context, which will ensure that only 1 object reference exist (pretty same as 1 but with DB reads or with less db reads with EF wrapper Cache provider)
For me it's obvious that 1st variant is better. But what is this (inMemmoryDB) in terms of Domain Driver Design and MVP?
Is it some kind of MVP super Model which has no View?(User can close the view with full object list, but we still need this full list for other views). It's hybrid (Memory\DB) Repository?
So for example we decided to use this InMemoryObjectGraph, how we are going to Sync it with DB using EF4?
We need to control every DB write operation to apply this changes to MemoryModel, and it's not obvious how to make this with EF4 where this opportunity isn't provided.
So in my opinion i should write data access layer on my own using old plain Ado .NET DataReader.
P.S. I have read:
Patterns of Enterprise Application Architecture (Martin Fowler)
Microsoft .NET: Architecting Applications for the Enterprise (Dino Esposito)
Applying Domain-Driven Design and Patterns: With Examples in C# and .NET (Jimmy Nilsson)
And i must say that: All the described patterns there are good but only when you write you Application from scratch (without using any 3d party Framework, and even with your own UI toolkit)...Read more...