"只读"实体框架?我试图使用RIA Services,EF和Silverlight [英] "Read-Only" Entity Framework? I'm trying to use RIA Services, EF, and Silverlight

查看:108
本文介绍了"只读"实体框架?我试图使用RIA Services,EF和Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Silverlight客户端中提供MySQL服务器数据,而我目前的攻击计划是将使用实体框架的MySQL与RIA Services进行交互,从而提供Silverlight Client和Entity Framework之间的数据访问。



但是,我只是想向用户呈现数据,我不希望我或其他人能够更改MySQL中的数据。



简而言之,我希望有一种方法可以忽略所有实体类型的setter。我只想要吸气我想要只读访问MySQL。但是,似乎我唯一的选择是将每个单独字段上的Setter更改为内部私人受保护公开



有没有更好的方法来完成我想要做的事情?

解决方案

如果您使用RIA服务...



当您创建域服务类(本质上是RIA是),它将弹出一个对话框,您可以点击启用编辑。在您的情况下,只需不要点击它,就不会生成编辑功能。



RIA服务用于连接服务器和客户端,它只能不生成CRUD的CUD部分



从某个博客http://www.silverlightshow.net/Storage/Users/Enrai/ ria-8.png


I'm trying to present MySQL server data in a silverlight client and my current plan of attack is to use Entity Framework to MySQL with RIA Services providing the data access between the Silverlight Client and Entity Framework.

However, I'm only trying to present data to the user and I do not want the possibility of me or someone else being able to change the data in MySQL.

In short, I wish there was a way to simply ignore the setters for all entity types. I only want getters. I want "read-only" access to MySQL. However, it seems my only option is to change "Setter" on each individual field to either Internal, Private, Protected, or Public.

Is there a better way to accomplish what I'm trying to do?

解决方案

If you're using RIA Services...

When you create a Domain Service Class (which is in essence what RIA is), it will bring up a dialog that you can click "enable editing" on. In your case, just don't click it and none of the editing functionality will be generated.

RIA Services is for connecting the server and the client, and it can just Not generate the CUD part of teh CRUD

from some blog http://www.silverlightshow.net/Storage/Users/Enrai/ria-8.png

这篇关于"只读"实体框架?我试图使用RIA Services,EF和Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆