2

I am using EF 6 with DB first (and POCO entity classes). I have a convention in my DB model that tables have a column called Created. This column got its default value at server side (GETDATE() in SQL Server) .

When I add or refresh my .edmx, for all new entities showing up in the schema I must manually set the Created attribute's StoreGeneratedPattern property to 'Computed'.

This does not sound a big deal, however it seems to me a productivity killer after in the last 5 years I did it zillon times.

So I decided to invest the time and automate this. I know how to manipulate the .edmx as XML or alternatively I also know that there dedicated C# classes to manipulate the object model. What are do not know:

  • How and where to plug it this manipulation to the VS 2015 schema import process (or let it done simply as a pre build action)
  • Is not there a simplest trick to achieve my goal? Or is not there a generic .edmx patcher for similar purposes?
g.pickardou
  • 32,346
  • 36
  • 123
  • 268

0 Answers0