locked
In 3 Tier Implementation with WPF,WCF,MVVM where is model resides? RRS feed

  • Question

  • Can any give an clear idea how we can implement 3 tier n-tier architecture using WPF,WCF, and MVVM.

    For exam If a i having application of Student management. I have Student, Teacher class will be there. In my view i have View for adding Student , teacher and there is one view for assigning the Teacher-students relations. We have defined WCF services for addteacher, student and getting the all the teachers and all students who all are allocation to a teacher and so on.

    If i have a ProxyObject for the WCF serview, From which layer i will the ProxyObject's Operation contracts?

       a) Whether i will call operation exposed by the proxy object from the ViewModel (say when  a command executed)

       b)or from the Model we have to call the Proxy objects operation method.

      So where should be the Model . In UI Layer, in BL Layer.

     

    Please give me some guidance about the architecture in detail if possible with some real example.

     

     

    Saturday, November 12, 2011 5:34 AM

Answers

  • The model is the bit where you get/update/whatever the data.

    So it's the proxy to wcf.  Tiers (as opposed to layers) usually means separate machines. So the wcf service would go onto a server. The proxy goes into the wpf solution along with the view and viewmodel.

    You can have the calls to your services direct from the viewmodel or you could have a separate layer does the service calls and just exposes an api used by the viewmodel.

    Commands themselves can be members of a viewmodel.  The actual code for each command could be in the viewmodel class or separate where commands might be used in more than one place.


    • Edited by Andy ONeill Saturday, November 12, 2011 6:35 PM
    • Proposed as answer by Sheldon _Xiao Tuesday, November 22, 2011 8:58 AM
    • Marked as answer by Sheldon _Xiao Sunday, December 11, 2011 5:09 PM
    Saturday, November 12, 2011 6:34 PM
  • Your calls to the WCF layer deffinately need to be in the BizLayer (Model).  Your UI needs to not care about a Proxy or any such thing.  It just needs to request information and that's it.  Where the information comes from (model) it shouldn't concern itself with.

    Simply put, UI should be dumb, it needs to make no decisions, and can be completely replaced with a different UI with no ramifications.  Where data comes from should be completely abstracted out, thus the need for Models (BizLayer).


    Michael Stacie
    • Proposed as answer by Sheldon _Xiao Tuesday, November 22, 2011 8:58 AM
    • Marked as answer by Sheldon _Xiao Sunday, December 11, 2011 5:09 PM
    Sunday, November 13, 2011 6:23 AM

All replies

  • The model is the bit where you get/update/whatever the data.

    So it's the proxy to wcf.  Tiers (as opposed to layers) usually means separate machines. So the wcf service would go onto a server. The proxy goes into the wpf solution along with the view and viewmodel.

    You can have the calls to your services direct from the viewmodel or you could have a separate layer does the service calls and just exposes an api used by the viewmodel.

    Commands themselves can be members of a viewmodel.  The actual code for each command could be in the viewmodel class or separate where commands might be used in more than one place.


    • Edited by Andy ONeill Saturday, November 12, 2011 6:35 PM
    • Proposed as answer by Sheldon _Xiao Tuesday, November 22, 2011 8:58 AM
    • Marked as answer by Sheldon _Xiao Sunday, December 11, 2011 5:09 PM
    Saturday, November 12, 2011 6:34 PM
  • Your calls to the WCF layer deffinately need to be in the BizLayer (Model).  Your UI needs to not care about a Proxy or any such thing.  It just needs to request information and that's it.  Where the information comes from (model) it shouldn't concern itself with.

    Simply put, UI should be dumb, it needs to make no decisions, and can be completely replaced with a different UI with no ramifications.  Where data comes from should be completely abstracted out, thus the need for Models (BizLayer).


    Michael Stacie
    • Proposed as answer by Sheldon _Xiao Tuesday, November 22, 2011 8:58 AM
    • Marked as answer by Sheldon _Xiao Sunday, December 11, 2011 5:09 PM
    Sunday, November 13, 2011 6:23 AM
  • Hi vKishoreKumar80,

    how about your concern?

     

    Best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 22, 2011 8:58 AM