コード例 #1
0
        public ConventionSet AddConventions(ConventionSet conventionSet)
        {
            var discriminatorConvention = new DiscriminatorConvention();

            var storeKeyConvention = new StoreKeyConvention();

            conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention);
            conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention);

            conventionSet.BaseEntityTypeChangedConventions.Add(discriminatorConvention);

            conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention);

            return(conventionSet);
        }
コード例 #2
0
        public override ConventionSet CreateConventionSet()
        {
            var conventionSet = base.CreateConventionSet();

            var discriminatorConvention = new DiscriminatorConvention();
            var storeKeyConvention      = new StoreKeyConvention();

            conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention);
            conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention);

            conventionSet.BaseEntityTypeChangedConventions.Add(storeKeyConvention);
            conventionSet.BaseEntityTypeChangedConventions.Add(discriminatorConvention);

            conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention);

            conventionSet.EntityTypeAnnotationChangedConventions.Add(storeKeyConvention);

            return(conventionSet);
        }