Here is a "simplified" class that can be mapped using NHibernate;
public class Template
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
}
As the ID field has a private setter we can no longer have code like this in our application where we manually set the ID field;
var DefaultTemplate = new Template { ID = (int)TemplateEnum.Default, Name = "Default" }
Here we are manually creating a DefaultTemplate object that we can assign to anything. Other Templates are manually created by users and saved to the database.
Any ideas how we can still achieve this kind of functionality?
Please note: C# Winforms, .NET 3.5 and we don't want to use Reflection for this.