I have the following class:
[DataContract()]
public partial class User
{
[DataMember()]
public int Id { get; set; }
[DataMember()]
public string Name { get; set; }
[DataMember()]
public string Surname { get; set; }
}
My DTO classes are in one assembly and my model (EF) is in another. Therefore all properties must be public get/set.
The Id is an identity column and is set by the db and also automapped. However I don't want that the user changes the id.
Is it possible to set an attribute on the property that sets the property to readonly when the user is working with the dto?