Existing EF T4 Templates against edml

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Torinth
Posts: 4
Joined: Wed 13 Jun 2012 20:32

Existing EF T4 Templates against edml

Post by Torinth » Wed 13 Jun 2012 20:41

Hi everyone,

When I try to use one of the existing T4 templates against an edml file I get output saying there was no EntityContainer in the model so no code was generated. Here is part of the T4 template I am using on how it initially loads the metadata. Against an edmx this works fine. Any thoughts?

<#@ template language="C#" debug="false" hostspecific="true"#>
<#@ include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
// Copyright (c) Microsoft Corporation. All rights reserved.

CodeGenerationTools code = new CodeGenerationTools(this);
MetadataTools ef = new MetadataTools(this);
MetadataLoader loader = new MetadataLoader(this);
CodeRegion region = new CodeRegion(this);

string inputFile = @"..\PathToMyEdml\MyEdml.edml";
EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);
string namespaceName = code.VsNamespaceSuggestion();

EntityContainer container = ItemCollection.GetItems<EntityContainer>().FirstOrDefault();
if (container == null)
{
return "// No EntityContainer exists in the model, so no code was generated";
}
#>

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

Re: Existing EF T4 Templates against edml

Post by Shalex » Thu 14 Jun 2012 14:42

Code: Select all

Against an edmx this works fine. Any thoughts?
Standard (Microsoft's) templates cannot be used against Devart's edml. If you are working with our object model (from edml), you should employ our templates (you can customize them for your needs).

Torinth
Posts: 4
Joined: Wed 13 Jun 2012 20:32

Re: Existing EF T4 Templates against edml

Post by Torinth » Thu 14 Jun 2012 14:47

Well the problem is that the template im using is not any of the model generation templates. Its a completely different type of template that generates some helper classes and its fairly complex. Was hoping to not have to spend the time re-building up the functionality trying to figure out which syntax in their template matches to the devart syntax. No problem itll just take some time

Post Reply