common behavior for common columns

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
kirby900
Posts: 4
Joined: Wed 19 Nov 2014 05:25

common behavior for common columns

Post by kirby900 » Wed 19 Nov 2014 16:34

I'm quite new to Entity Developer. I plan to import roughly 50 tables into a model from an existing Oracle database. Each of the tables has two fields to keep track of the last update: LAST_UPDATE_ID and LAST_UPDATE_DATE.

Is there a way to apply a rule that all occurrences of the LAST_UPDATE_ID column would be set to USER on insert or update, and that all occurrences of LAST_UPDATE_DATE would be set to SYSDATE on insert or update?

kirby900
Posts: 4
Joined: Wed 19 Nov 2014 05:25

Re: common behavior for common columns

Post by kirby900 » Wed 19 Nov 2014 18:22

Maybe I should add that we anticipate the table content being exposed through a Web API.

I know that Entity Developer allows one to specify default values in Model Explorer under the *.Store node. I'm trying to figure out how to make this happen without having to manually apply the USER and SYSDATE default values to each table.

kirby900
Posts: 4
Joined: Wed 19 Nov 2014 05:25

Re: common behavior for common columns

Post by kirby900 » Thu 20 Nov 2014 18:05

Any suggestions from anyone? There MUST be a better way than setting each of the fields' default values by hand.

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

Re: common behavior for common columns

Post by Shalex » Fri 21 Nov 2014 13:43

You can do this in the following way: expand all nodes of needed tables in *.Store (it is more convenient to go from down to upside when opening nodes with arrows of your keyboard), then select all LAST_UPDATE_ID columns keeping Ctrl key pressed and set Default Value=USER for all selected columns simultaneously. The LAST_UPDATE_DATE columns can be initialized similarly.

Another way: select diagram surface and press Ctrl + F and look for LAST_UPDATE_ID, then double click on each found LAST_UPDATE_ID in the Model Find Results window and insert (Ctrl + V) USER into Default Value.

One more way: modify your T4 template to initialize default values of LAST_UPDATE_ID and LAST_UPDATE_DATE properties in conceptual (CSDL) part of the model.

kirby900
Posts: 4
Joined: Wed 19 Nov 2014 05:25

Re: common behavior for common columns

Post by kirby900 » Fri 21 Nov 2014 16:37

Thank you for the suggestions! I'll begin trying them right away.

Post Reply