locked
I need help desiging smart client application architecture RRS feed

  • Question

  • 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)...

    Sunday, August 1, 2010 8:16 PM

Answers

  • Yes looks like i have to build one more layer on top of this all where I can control the data being added\deleted\modified, too bad Entity Framework doesn't provide this functionality directly and i have to create some abstraction on top of it.
    • Marked as answer by Alex Burtsev Tuesday, September 28, 2010 12:52 PM
    Thursday, August 19, 2010 8:40 PM

All replies

  • Heh still no answer, interesting why?  My message is to long? It's unclear? No one have thoughts about this subject or what?

    Anyway i made my decision about code strategy and already wrote critical parts of program, and so far without problems.

    But any way i want to hear some thoughts on this topic.

    Thursday, August 5, 2010 11:35 AM
  • Why not use this? http://msdn.microsoft.com/en-us/library/ms668604.aspx 

    ObservableCollection<T> Class Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.

    The observable list could be populated and displayed using your current implementation. Since it is a List, you could filter the list for your views and since it is observable, your updates will be announced to all parts interested.

    Tuesday, August 17, 2010 7:29 PM
  • Why not use this? http://msdn.microsoft.com/en-us/library/ms668604.aspx

    ObservableCollection< T > - Doesn't work with Windows Forms data binding, well it work I assume but just usual Collection, it appeared after WinForms control so they doesn't use this Interfaces. BindingList<T> is used in WinForms, and surely i use it. But the problem is deeper and single BindingList can't solve this.
    Thursday, August 19, 2010 7:14 AM
  • I see a few topics on stackoverflow that show how to use Observable Collection with Winforms, but it looks messy.

    Maybe you could abstract the problem of synchronization in your own code. Maybe a syncmanager that can manage the updates between your entities and the UI? This manager receives the events that some data in your collection has changed and updates the db, then if successful, rebinds the ui. bascially any two way changes are done through this manager, keeping all the parties in sync.

    Thursday, August 19, 2010 8:25 PM
  • Yes looks like i have to build one more layer on top of this all where I can control the data being added\deleted\modified, too bad Entity Framework doesn't provide this functionality directly and i have to create some abstraction on top of it.
    • Marked as answer by Alex Burtsev Tuesday, September 28, 2010 12:52 PM
    Thursday, August 19, 2010 8:40 PM