Print Page | Close Window

How-To: Disable DevForce Code Generation

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1731
Printed Date: 21-Apr-2026 at 10:39am


Topic: How-To: Disable DevForce Code Generation
Posted By: rallman
Subject: How-To: Disable DevForce Code Generation
Date Posted: 20-Apr-2010 at 3:11pm
DevForce 2010 has taken over code generation on my existing EF projects. Besides using the Extension Manager of Visual Studio to disable for all projects, how can I disable on a per project/solution basis?



Replies:
Posted By: davidklitzke
Date Posted: 20-Apr-2010 at 3:28pm
This is from the Business Object Mapping section of the Learning Resources:
 
When an EDMX file is saved for the first time a new project item will be added to the project containing the EDMX file.  This project item will have the same name as the EDMX file but with a further ‘.tt’ extension.   Several additional files will be generated ‘under’ this project item.  One of these will be a ‘ReadMe’ file that explains in more detail how to customize template generation.  The other files will have an ‘.IB.Designer’ extension and will contain the DevForce generated code.  Feel free to inspect these files but do not modify them because they will be regenerated each time the EDMX file changes.  In most cases there will only be a single such file, but there are options described later to allow the generated code to span multiple files. 
 
One further side effect of this operation is to ‘turn off’ the standard Entity Framework code generation mechanism.  DevForce does this by modifying the ‘Custom Tool’ property associated with the ‘EDMX’ file by adding a ‘<RemoveToRestore>’ prefix  to the custom tool name specified there.  (At any time this prefix may be removed to restore the standard Entity Framework code generation.  It is usually a good idea to remove the DevForce ‘.tt’ file, and its underlying children, after this is done to avoid conflicts.) 


Posted By: rallman
Date Posted: 20-Apr-2010 at 3:45pm
Thanks for the quick reply.
 
My readme file does not describe how to disable the DevForce templates and every time I remove the '<RemoveToRestore>' prefix, it gets added back when the edmx is saved. Also, the .tt structure and IdeaBlade references get recreated. This was an exting edmx file in an existing project. As this is not a DevForce project I do not want any references to DevForce assemblies.
 
Can this be done?


Posted By: ting
Date Posted: 20-Apr-2010 at 4:03pm
At the moment, those are the only two options, disabling it globally with the Extension Manager or removing the prefix.  We have a feature request to find a better way to switch between DevForce and raw EF on a per project basis.


Posted By: rallman
Date Posted: 20-Apr-2010 at 4:09pm
Just to be clear. Every time I make a change and save an edmx file, I must: Remove the '<RemoveToRestore>', delete the .tt structure, and remove the IdeaBlade references?
 
I would like to add a +1 to the feature request to switch between EF and DF per project (and default existing projects to EF). At this point I am only evaluating DevForce but doing real work in EF so it is quite intrusive.


Posted By: ting
Date Posted: 22-Apr-2010 at 4:56pm
Ok, this is being implemented.  In the next release, we will allow you to control DevForce code generation on a per EDMX basis.
 


Posted By: fjrodriguezcom
Date Posted: 11-Jun-2010 at 3:31am
+1


Posted By: ting
Date Posted: 11-Jun-2010 at 6:39pm
Already done ;).  In DevForce 6.0.3 the property sheet for the edmx has a setting called "DevForce Enabled" which you can toggle on or off.



Print Page | Close Window