views:

114

answers:

1

I was wondering if anyone knows of some good community distributed custom DDL templates for Entity Framework 4.0. The default DDL to SQL10 Works well enough, but we're looking to do some customization to the naming convention that it just isn't offering us.

I'm not really finding many samples out there of people doing this, so I was hoping someone might know of a resource I'm overlooking (perhaps I am searching for it wrong, or misunderstanding how the whole process works)

Specifically we're wanting to change up how it writes out fields from relationships. For instance, the default template puts in..

tablename_propertyendpoint_propertyname.

We're wanting to find tune this to our naming scheme a little more. And none of us can quite figure out where in the .tt files it is doing this exact behavior.

One of the more specific problems I am trying to solve is how it appends and changes property names in the database. For example..

Products
-------
Id (int)
Name (varchar(32))

Customers
-------
Id
Name

Carts
-------
Id
Customer (fk)

Baskets
-------
Cart (fk) (pk)
Product (fk) (pk)

Assuming this is my object structure... It would look much like listed above. but the database generator expresses it like this..

Products
-------
Id (int)
Name (varchar(32))

Customers
-------
Id
Name

Carts
-------
Id
Customer_Id (fk)

Baskets
-------
Cart_Id (fk) (pk)
Product_Id (fk) (pk)

Now, I realize this doesn't actually 'hurt' anything; but consistency is kind of important to me, and this is a good place to 'learn' how all of this code is generated. I basically wish to design it so that it does not change the names of my fields on me.

+1  A: 

Absolutely - you can download the entity designer database generation power pack here: http://visualstudiogallery.msdn.microsoft.com/en-us/df3541c3-d833-4b65-b942-989e7ec74c87

The problem with column names is that they are needed in two places: In the MSL and in the SSDL, and that is where they are generated. So, your easiest bet is to take the MSL and SSDL T4 templates and look at those.

Noam Ben-Ami
I'm looking at this power pack, but I am a little confused as to how it will actually assist in this specific goal. Is there a setting or configuration UI that I am just not seeing? Or some kind of markup files it doesn't tell me about?
Stacey
I have updated my post to be a little more specific. I realize now that I was very vague in my original intent.
Stacey