NHibernate File Names

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
smlemmon
Posts: 7
Joined: Sat 26 Jan 2013 09:51

NHibernate File Names

Post by smlemmon » Thu 18 Apr 2013 15:40

Hi,

I just wondered if there is any way to stop the file names that are generate for the NHibernate entities and mapping files being prefixed with the model name.

For example, if my model name is TestModel, all the generated files come out as :-

TestModel.Xxxxxxx.cs etc...

I just want the name to be Xxxxxx.cs without the model name prefix.

Many thanks

Simon

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

Re: NHibernate File Names

Post by Shalex » Mon 22 Apr 2013 08:31

For this, you should modify a code generation template manually:
1) right click on the template in Model Explorer > Copy to Model Folder
2) open template and replace

Code: Select all

string rootFileName = baseFileName + "." + cls.Name;
with

Code: Select all

string rootFileName = cls.Name;
3) save template and regenerate the code.

Joe Smith
Posts: 32
Joined: Thu 09 May 2013 20:18

Re: NHibernate File Names

Post by Joe Smith » Thu 09 May 2013 21:23

The naming stategy of ED is indeed odd, IMHO.
I hope this will change in a future release because I'd rather not change the standard template manually.

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

Re: NHibernate File Names

Post by Shalex » Wed 15 May 2013 06:38

Generating names like TestModel.Xxxxxxx.cs is a common feature of different ORM designers. Different models within a project may have classes with the same name; as a result one file overwrites another one when naming Xxxxxxx.cs is used.

Post Reply