Print Page | Close Window

Autogenerated Developer Classes have wrong namespace

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=1796
Printed Date: 21-Apr-2026 at 5:49am


Topic: Autogenerated Developer Classes have wrong namespace
Posted By: jmpinchot
Subject: Autogenerated Developer Classes have wrong namespace
Date Posted: 07-May-2010 at 2:37pm
I have an edmx where the namespace is defined as Data.Core, when I set Generate Developer Classes the namespace they belong to is Data.

I've attempted to extend the DomainModelTemplate to write out the namespace properly but the temporary file that gets generated during the process has the following error: Compiling transformation: The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    c:\Users\jpinchot.TRADE\AppData\Local\Temp\4q4ezyop.0.cs

Is there another way to define the namespace that the developer classes get defined in? Or is there anything wrong with the following tt file?

<#@ template  language="C#" debug="true" hostSpecific="true" #>
<#@ output extension=".ReadMe" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ Assembly Name="IdeaBlade.VisualStudio.DTE.dll" #>
<#@ Assembly Name="IdeaBlade.VisualStudio.OM.CodeGenerator.dll" #>
<#@ Assembly Name="IdeaBlade.EntityModel.Edm.Metadata.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="IdeaBlade.VisualStudio.DTE" #>
<#@ import namespace="IdeaBlade.VisualStudio.OM.CodeGenerator" #>
<#@ import namespace="IdeaBlade.EntityModel.Edm.Metadata" #>
<#@ import namespace="Data" #>
<#
    // Source for this file located at: C:\Users\jpinchot.TRADE\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\IdeaBlade, Inc\IdeaBlade OM Designer Extension\6.0.1.0\DomainModelTemplate.tt
    // Core.edmx  <--- This is needed so that "Transform Related Text Templates On Save" works correctly.
    var template = new CoreDomainModelTemplate(this);
    template.Generate();
#>
<#+
#>



Replies:
Posted By: ting
Date Posted: 10-May-2010 at 4:51pm

Yes, you can set the namespace on the generated DevForce Entities by going to the Properties page of the .tt file and setting the Custom Tool Namespace to whatever you want.

Double check that you do this on the .edmx.tt file as the regular .edmx file is for the raw Entity Framework and won't affect the DevForce code generation.
 
 



Print Page | Close Window