コード例 #1
0
ファイル: ExtendMap.cs プロジェクト: wulaiwei/WorkData
        public static EntityMap GetEntityMap(this Type entityType, DbContext context)
        {
            var metadataResolver = new MetadataMappingProvider();
            var entityMap        = metadataResolver.GetEntityMap(entityType, context);

            return(entityMap);
        }
コード例 #2
0
ファイル: ExtendMap.cs プロジェクト: wulaiwei/WorkData
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }