Changing default behaviour of dbcontext template
Posted: Thu 15 Oct 2015 11:07
Hi,
I am working on a project with MVVM and WPF.
It happens that I need to tweak the DbContext template to achieve some features that will prevent a lot of headaches
First, I would libe being able to add in head of each model something like:
Using this string on resource will allow me being able to translate entity name:
Also would like being able to apply this on each Property:
Now an extra a bit more hard I think...
For properties that would have a max or min lenght, I would like to have it also as constants, so I can use it for validation and some business rules outside of model:
this way besides being able to use in validations I can also use this information outside of class.
Can you help me?
Thanks
I am working on a project with MVVM and WPF.
It happens that I need to tweak the DbContext template to achieve some features that will prevent a lot of headaches

First, I would libe being able to add in head of each model something like:
Code: Select all
public const string Entity = "Entity";
Code: Select all
resource.Localization.Get(Model.Entity);
Code: Select all
public const IdProperty = "Id";
public Guid Id{get;set;}
For properties that would have a max or min lenght, I would like to have it also as constants, so I can use it for validation and some business rules outside of model:
Code: Select all
public const int Code_MinLength = 3;
public const int Code_MaxLength = 7;
public int Code{get;set;}
Can you help me?
Thanks