EF 6.1 EntitySet.MetadataProperties["Schema"] is null

Jan 22, 2014 at 11:54 AM
I want to get database schema from t4 template.

but EntitySet.MetadataProperties["Schema"] is null

this is my modified code on model.tt template:

var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
string szSchName = "";
foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
{
    if (entitySet.ElementType.Name == entity.Name)
    {
        szSchName = entitySet.MetadataProperties.First(p => p.Name == "Schema").Value.ToString();

        break;

    }
}
What I'm miss ?


Regards,
Ardi