Reputation: 804
I want to implement an IsComplexType() method, which check if the given property from an entity is a ComplexType.
After reading Entity Framework's source code, i find it has implemented one in the "Helper" class, but the class is "internal", so i can't use it outside Entity Framework project.
I wonder if there's a public API in Entity Framework which enable me to do this. If not, how can i implement it?
Upvotes: 0
Views: 456
Reputation: 6489
Try this :
var dbContext = new DbContext("ConnectionString");
var complexType = dbContext.Entry(TEntity).ComplexProperty("ProperyName");
if (complexType != null)
{
// This is a Complex Type
}
Hope this help.
Upvotes: 3