R – “Read-Only” Entity Framework? I’m trying to use RIA Services, EF, and Silverlight

data modelingentity-frameworknetsilverlightwcf-ria-services

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?

Best Answer

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
(source: silverlightshow.net)

Related Topic