简体   繁体   中英

How closely is Entity Framework tied to WCF RIA Services?

I'm trying to build a simple proof-of-concept "business application" in Silverlight and I keep running into a wall in trying to get data in and out of the database. I'm currently trying to learn WCF RIA Services, but I'm stuck because I can't get Entity Framework to work with existing tables in my database (they don't show up in the model designer even though I add them via the wizard).

I'd still like to use RIA Services (I think), but I don't know how much I would lose by abandoning EF in the process. How closely are they tied together?

The backend can be just about anything you want. If EF isn't working for then Linq to SQL is viable alternative. I believe there is even and "Add..." template provided for you.

If EF is giving you issues I believe you can still use LINQ-to-SQL with RIA Services.

With RIA all that really matters is that you provide a domain service that extends the correct class (I don't remember what class). EF is nice because there is a template for a domain service to an EF model, but you should be able to generate the same template off a LINQ-to-SQL model.

All WCF RIA Services requires is an IQueryable provider - which you can write yourself, if you really, really want to :-)

WCF RIA Services is not tied to neither Entity Framework, nor Linq-to-SQL (although those two provide "out of the box" IQueryable providers, so they're probably your first bet).

The WCF RIA Services Wizard for adding a new Domain Service requires either a provider that supports DataContext or ObjectContext. EntityFramework, Linq2sql, and NHibernate fall into one of these two categories.

However, you can feel free to implement a DataService without using the wizard if so inclined.

I'd focus on the EF issues first(sql2005 is supported), as the wizard makes the process very easy to learn.

正如Marc所说,你不仅限于EF或Linq to SQL - 这里是一个RIA服务和实体框架演示的示例,用于替换EF和NHibernate的持久层: http//blogs.msdn.com/b/ brada /存档/ 2009/08/06 /企业应用程序,例如换Silverlight的3-RTM-和净RIA服务-七月更新部分nhibernate.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM