Stored Procedure Naming

Dec 14, 2007 at 10:03 AM

First off, Ive just started evaluating the RF and I'm very impressed. This is going to save me so much time.

How can I change the default name of the stored procedures? When I go through the wizard it names the CRUD SPs as follows:
ActionEntityname. i.e. InsertUser

I'd like it to produce EntitynameAction. i.e UserInsert, User_Delete etc etc

Is there a way I can change the default naming convention for the CRUD SPs so that I don't have to renaming every single one? This would be VERY helpful


Jan 3, 2008 at 2:45 AM
I believe this is more of a template(T4 files) customisation rather then RF change. The wizard basically uses the MS template engine based on 'T4' files to generate code, these tempalte files can be found in the C:\Program Files\Microsoft patterns & practices\Data Access Guidance Package Setup\Templates\T4\SP\SqlServer (depending where you have installed the DAGP) directory. The file you want to edit is 'StoredProcedures.t4'.

Get to know T4 templates as they provide flexability to customise code that the guidance package wizards generate.

  • Might want to checkout T4 editor (my understanding is that the editor comes with VS 2008).

Jan 27, 2008 at 9:38 PM
The code behind the sproc naming conventions is in Microsoft.Practices.RepositoryFactory.CodeGeneration.ObjectModel.NamingConventions.NamingHelper. I'm in the middle of changing it to reflect Mat's naming style (since it is similar to mine). I'm also fixing the way it handles schemas, since I'm of the opinion Schema is really part of the namespace, and not part of the classs name. I'll post the changes up on my blog, since I don't have checkin rights, and I'm not sure if my style is the same as the majority. I guess if enough people want the change, the dev team can check my changes in, but that's their call.

Don Demsak