What the best way to create Data Access desgin with PRISM RRS feed

  • Question

  • Hello experts,

    I found excellent arcticle on msdn - How Stock Trader RI works and about to follow it to build an application. But i am stuck how to design data access and make it use in each different modules ?

    Whats the best design can you suggest for me?


    Thanks, Krishna Nellutla
    Thursday, March 31, 2011 7:43 AM

All replies

  • Well it's certainly an impressively complicated design.  Not sure I'd want that complication in most applications though.

    I'm also not sure I understand the question.

    Entity framework on WCF services is what I'd suggest.

    WCF RIA is a great match for silverlight but more sort of "OK" for WPF so the details depend on what you are doing.

    Thursday, March 31, 2011 10:20 AM
  • Hi Andy,

    Thanks so much for taking time to reply for my question,

    Yes, it's really a complicated architecture but can be utilized for building other application who has agile project. am still exploring/going through various designs over the internet.

    I agree WCF RIA would be ideal for silverlight & entity framework for WPF but question is, if we develop data Access as an assembly (whether it is in RIA services or entity framework), how feasible it would be to share between modules? will it be a good practise?

    And if opt to have a repository pattern using this sampple application, How can i plug in btw modules?


    Thanks, Krishna Nellutla
    Friday, April 1, 2011 2:11 AM
  • WCF services can easily be part of some other project if they're web services.

    Some EF layer can be a separate solution, compiled and added as a reference to your separate 2 solutions.  This isn't very neat in practice if you change your database though.  You want to stabilise the database first.  Mind you, that's not a bad idea for almost all projects anyhow.

    Bear in mind that Entity Framework is generated code.  So if you couldn't share modules then, so what...

    Friday, April 1, 2011 8:15 AM
  • Andy,

    That's where i stuck, If i go with data access as an assembly(dll). It would be a messy design to share btw various module.

    How do i need to over come such things?

    Thanks, Krishna Nellutla
    Friday, April 1, 2011 9:26 AM
  • My advice would be only to share self contained interfaces externally.

    By which I mean your two applications consume the same web services but any classes defining types etc are duplicated.

    It's way simpler that way.

    As an aside, PRISM is actually pretty tricky stuff.  Some people say they'd rather write a silverlight application and then just re-use xaml and some code in a WPF app.  The  theory being whilst that appears to duplicate code it's quicker to do that than try and make code that suits both. They ask - do you really want an app which only the absolute expert devs are comfortable working on it and the rest create a mess.  I found those discussions quite convincing.

    As I think I recall writing on another thread though, an MVVM silverlight app can potentially require very little code change to make it work as a MVVM WPF app.  The WPF app might be a bit odd to someone used to WPF but it's possible.

    Whilst that article looks pretty clever.

    Is that a good thing?

    Maybe you want to set other people's ideas of detail designs aside for a while and consider how your application might best work.  Generally I find the simpler the architecture the better I understand it, the better everyone in the team understands it and the better the end product. 

    Friday, April 1, 2011 10:55 AM
  • Hello there,


     A simple flow diagram


    WPF <==> WCF <==> BLL <==> DAL <==> Database.


    If you do not have business rule for validation , then do remove the BLL layer..


    Second option,


    WPF <==> WCF <==> DAL <==> Database.


    Before doing following this two kind of approach , please do proof of concept , thoroughly test follow whether the application is working as your functional requirements. 

    That is it.


    Phijo Mathew Philip.


    Friday, April 1, 2011 5:40 PM
  • Hi 

    You can follow the Prism framework , but the based on the databse funtionality , in the dal there will be single edmx file , you can separate c# files for the various database functionality. It always best to the software industry standards created by microsoft. 


    The other options work fine, but the we talk about the software standards and implemenation , it would be best if the proper standards are followed, from your side you need to understand the how really the prism framework , then created the dal code as per rules set by the prism framework.

    This kind of approach makes your life very easy. 

    That is it.


    Phijo Mathew Philip.

    Friday, April 1, 2011 5:50 PM
  • Hi Andy,

    Thanks again for taking time to reply for my question.

    Probably i will go and create prototype, thus i can get more ideas to full fill me needs.

    Thanks, Krishna Nellutla
    Wednesday, April 6, 2011 7:21 AM
  • Small scale test is often a good way to explore some approach one is unclear about.

    I find proof of concepts invaluable as they force me to think things through.  Often something doesn't work the way I hope/assume it will. 

    Good luck,

    Wednesday, April 6, 2011 8:51 AM