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";
}
#>
Existing EF T4 Templates against edml
Re: Existing EF T4 Templates against edml
Code: Select all
Against an edmx this works fine. Any thoughts?
Re: Existing EF T4 Templates against edml
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