I have my Entity Framework model setup with a Sql Server 2008 backend. In the database, every table has a "CreatedBy" and "CreatedDate" field. These values are assigned when the object is saved, either by the Entity Context, or by Sql Server. In Sql Server, these fields are marked as "not null".
- I want these fields to be available to users for reading, but not for writing, and
- when they create a class using the static "CreateXXX" method of the Entity Framework generated partial class, I do not want the user to have to fill in a value (pretty obvious along with the read-only nature).
I assume that this is some combination of marking Setters as internal, and marking the properties as Nullable, but I would greatly appreciate someone who know exactly how to do this to explain it.
Thanks you.