public static EntityMap GetEntityMap(this Type entityType, DbContext context) { var metadataResolver = new MetadataMappingProvider(); var entityMap = metadataResolver.GetEntityMap(entityType, context); return(entityMap); }
public static EntityMap GetEntityMap <T>(this DbContext context) where T : class { var metadataResolver = new MetadataMappingProvider(); var entityType = typeof(T); var entityMap = metadataResolver.GetEntityMap(entityType, context); return(entityMap); }
public void ef_extension_mapping_test() { var db = new TrackerContext(); var resolver = new MetadataMappingProvider(); var map = resolver.GetEntityMap(typeof(AuditData), db); Assert.Equal("[dbo].[Audit]", map.TableFullName); }
public void GetInheritedEntityMapAuditData() { var db = new TrackerContext(); var resolver = new MetadataMappingProvider(); var map = resolver.GetEntityMap(typeof(CodeFirst.Entities.Task), db); //var map = db.Audits.ToObjectQuery().GetEntityMap<AuditData>(); Assert.Equal("[dbo].[Task]", map.TableName); }
public void GetInheritedEntityMapAuditData() { var db = new TrackerContext(); var resolver = new MetadataMappingProvider(); var map = resolver.GetEntityMap(typeof(CodeFirst.Entities.Task), db); //var map = db.Audits.ToObjectQuery().GetEntityMap<AuditData>(); Assert.AreEqual("[dbo].[Task]", map.TableName); }
public void GetEntityMapAuditData() { var db = new TrackerContext(); var resolver = new MetadataMappingProvider(); var map = resolver.GetEntityMap(typeof(AuditData), db); //var map = db.Audits.ToObjectQuery().GetEntityMap<AuditData>(); Assert.Equal("[dbo].[Audit]", map.TableName); }
public void GetEntityMapAuditData() { var db = new TrackerContext(); var resolver = new MetadataMappingProvider(); var map = resolver.GetEntityMap(typeof(AuditData), db); //var map = db.Audits.ToObjectQuery().GetEntityMap<AuditData>(); Assert.AreEqual("[dbo].[Audit]", map.TableName); }