Changing default behaviour of dbcontext template

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
figueiredorj
Posts: 36
Joined: Fri 12 Apr 2013 19:05

Changing default behaviour of dbcontext template

Post by figueiredorj » 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:

Code: Select all

public const string Entity = "Entity";
Using this string on resource will allow me being able to translate entity name:

Code: Select all

resource.Localization.Get(Model.Entity);
Also would like being able to apply this on each Property:

Code: Select all

public const IdProperty = "Id";
public Guid Id{get;set;}
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:

Code: Select all

public const int Code_MinLength = 3;
public const int Code_MaxLength = 7;
public int Code{get;set;}
this way besides being able to use in validations I can also use this information outside of class.

Can you help me?
Thanks

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: Changing default behaviour of dbcontext template

Post by Shalex » Thu 15 Oct 2015 16:44

We have sent a modified DbContext template to the email address specified in your forum profile.

figueiredorj
Posts: 36
Joined: Fri 12 Apr 2013 19:05

Re: Changing default behaviour of dbcontext template

Post by figueiredorj » Tue 17 Nov 2015 10:45

Many thanks :) it worked

Post Reply