开发者

MVVMLight, Silverlight, Entity Framework

开发者 https://www.devze.com 2023-03-19 16:42 出处:网络
I have created a) a basic application MVVMLight framework. b) another project in the same solution having an Entity Model (NorthwindModel.edmx).

I have created

a) a basic application MVVMLight framework.

b) another project in the same solution having an Entity Model (NorthwindModel.edmx).

c) a WCF service to retrieve data through the entity model.

Now I want to link a, b, and c together. How do the project mentioned in a) above interact with the other two? How can I display/bind the data using the edmx in the View of the MVVM? Do I have to write code in the ViewModel class/classes to achieve this?

开发者_运维问答

I browsed through many websites, checked many questions here on SO, but none seems to throw any light for me in this regard. The examples that I saw involved a lot of coding in the ViewModel class. If that's the only way to go about it, then why do people say MVVM with Silverlight requires very little coding?


You can use WCF RIA Services to bridge the gap between ASP.NET and Silverlight.

Get Started - WCF RIA Services


You will need to create a Silverlight library project, add entity files as link to the project. This will enable you to use the Entities in your Silverlight application.

how to add files as link

Actually you need a Web project where you host your webservices, then you need your business logic layer and data access layer where you retrieve data, then you need the entities and a silverlight entities project. After this you create your Silverlight project and add web service reference to it and thats it, now you are ready to use MVVM.


I think you could use this to refer how to build a solution with multiple projects and also have entity framework with WCF RIA services.

To ensure you project is running MVVM light you could use Nuget to inject the necessary files into your client project. Information on this is available here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号