In the MyContext.tt
, I made the following changes:
Added a new method to the CodeStringGenerator
class:
public string PropertyTypeName(EdmProperty edmProperty)
{
return _typeMapper.GetTypeName(edmProperty.TypeUsage);
}
Added the following declaration:
<#
// Determine the type if the "Id" column for the DomainEntity<T> base type
var idProperty = typeMapper.GetSimpleProperties(entity).SingleOrDefault(p => p.Name.Equals("Id"));
#>
And in the class declaration:
<#=codeStringGenerator.EntityClassOpening(entity)#> : IDataEntity<<#=codeStringGenerator.PropertyTypeName(idProperty)#>>