3
votes

I am writing an application ( WPF ) where i use the prism framework. I have a client with the shellview. I have some module's. So that are different projects. Each module is a sepperate project. The modules are loaded by Unity.

I have the following

Solution
 Client
    Modules
    Client ( app )

 Common
    Entities

 Server
    Data
    Web

So you can see i have an Data Project under the server folder. There you can find the edmx. The Web project is empty, the Entities project is also empty.

The Client (app) has a shellview with its bootstrapper. The client works. Only the data access layer must be integrated.

What is the best solution to do the data access? WCF, something else? What template do we need to use for the entities. How can we use the service in the modules where al the code (View/ViewModel) is?

Pff, i am looking and read so much. Found some topics on stackoverflow. But none of the topics start's from the begin. Hope someone can help me.

3
Which method of data access you use is pretty much orthogonal to your choice to use prism/unity. The method you choose will depend more upon other factors like what your database looks like, whether you're in control of the data store, what your scalability needs are, whether you want to use an ORM, etc. - lecrank
You should try focusing your question better. You asked a handful of questions (What method of data access? Can I use my DAL directly from my viewModel? etc.) These are all questions that you should probably ask separately and explain each thoroughly if you expect people to understand the context of your problem and offer good advice. Otherwise, it seems that you are merely saying "I designed part of this project, but got stuck... can somebody out there in internet-land do the rest for me?" - lecrank
My database is build up with the Entity Framework. Generated the code from the edmx that i builded. Scalability -> It wil only be used in my local network. I used already WCF services but not with edmx features/modules prism. Always directly from the Service to a client, with contracts that i wrote by myself. Now it should use the edmx entities. I don't want that somebody do the rest. I hope only someone can help me, to start right. - Sven

3 Answers

0
votes

I suggest you to generate POCO or STE on .edmx and use the Repository Pattern for database access. Create a Separate WCF Service Project and call these repositories.

Your Prism Solution will have a Proxy Project with Static Class to return Service Object and your Client (Prism) App will call the WCF Services.

0
votes

May be you can have a look at Calcium SDK (http://calcium.codeplex.com/) which leverages Prism modular app development along with support for WCF services.

0
votes

If you are familliar with WCF and EntityFramework on the server side then this is the way to go.

In order to reuse the generated proxy classes from services you can keep your service references in a common assembly that you reference from all modules. Something like "Infrastructure" is a good naming convention.

In case one of your modules needs a unique functionality then you put the service reference on that project.

In case of WPF clent: Use entity framework code first and seperate your Model classes in a seperate assembly so you can reuse them in your main client and modules.

In case of silveright client: If duplicate model classes and namespaces when generating the service proxy is an issue for you you can checkout WCF RIA Services. Always keep in mind that you can link two assemblys a silverlight and a .net one using RIA Link in Visual Studio project file properties. Then any server side code file you chose can be reused on the client. This is possible using the "shared" suffix in your filename (ex: enums.shared.cs) regardless if you are using WCF services or not. You can find out more here and here

Hope this helped.