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

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

问题描述

我想present MySQL服务器的数据在Silverlight客户端和我目前的进攻计划是利用实体框架到MySQL与RIA服务提供Silverlight客户端和实体框架之间的数据访问。

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.

不过,我只是想present数据显示给用户,我不希望我的可能性或其他人能够改变MySQL中的数据。

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.

总之,我希望有一种方式来简单地忽略制定者为所有实体类型。我只希望干将。我想只读访问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?

推荐答案

如果您正在使用RIA服务...

If you're using RIA Services...

当您创建一个域服务类(这是在本质上有什么是RIA),它会弹出一个对话框,你可以点击启用编辑上。在你的情况,只是不点击它并没有任何的编辑功能将会产生。

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是用于连接服务器和客户端,它可以只是没有产生德CRUD的CUD部分

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

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

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