/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); conventionSet.ModelInitializedConventions.Add(new ContextContainerConvention(Dependencies)); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, new ETagPropertyConvention(), typeof(ValidatingConvention)); var discriminatorConvention = new CosmosDiscriminatorConvention(Dependencies); var storeKeyConvention = new StoreKeyConvention(Dependencies); conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeRemovedConventions, (DiscriminatorConvention)discriminatorConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, (DiscriminatorConvention)discriminatorConvention); conventionSet.ForeignKeyRemovedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyRemovedConventions.Add(storeKeyConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(storeKeyConvention); return(conventionSet); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); conventionSet.ModelInitializedConventions.Add(new ContextContainerConvention(Dependencies)); conventionSet.ModelFinalizingConventions.Add(new ETagPropertyConvention()); var storeKeyConvention = new StoreKeyConvention(Dependencies); var discriminatorConvention = new CosmosDiscriminatorConvention(Dependencies); var keyDiscoveryConvention = new CosmosKeyDiscoveryConvention(Dependencies); conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeAddedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeRemovedConventions, (DiscriminatorConvention)discriminatorConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, (DiscriminatorConvention)discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.EntityTypePrimaryKeyChangedConventions.Add(storeKeyConvention); conventionSet.KeyAddedConventions.Add(storeKeyConvention); conventionSet.KeyRemovedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.KeyRemovedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.ForeignKeyRemovedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyRemovedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyPropertiesChangedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyUniquenessChangedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.ForeignKeyOwnershipChangedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(keyDiscoveryConvention); ReplaceConvention(conventionSet.PropertyAddedConventions, (KeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.PropertyAnnotationChangedConventions.Add(storeKeyConvention); return(conventionSet); }
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); }
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); }
public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); var discriminatorConvention = new CosmosDiscriminatorConvention(Dependencies); var storeKeyConvention = new StoreKeyConvention(Dependencies); conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeRemovedConventions, (DiscriminatorConvention)discriminatorConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, (DiscriminatorConvention)discriminatorConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(storeKeyConvention); return(conventionSet); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); conventionSet.ModelInitializedConventions.Add(new ContextContainerConvention(Dependencies)); conventionSet.ModelFinalizingConventions.Add(new ETagPropertyConvention()); var storeKeyConvention = new StoreKeyConvention(Dependencies); var discriminatorConvention = new CosmosDiscriminatorConvention(Dependencies); KeyDiscoveryConvention keyDiscoveryConvention = new CosmosKeyDiscoveryConvention(Dependencies); InversePropertyAttributeConvention inversePropertyAttributeConvention = new CosmosInversePropertyAttributeConvention(Dependencies); RelationshipDiscoveryConvention relationshipDiscoveryConvention = new CosmosRelationshipDiscoveryConvention(Dependencies); conventionSet.EntityTypeAddedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAddedConventions.Add(discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeAddedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeAddedConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.EntityTypeAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeIgnoredConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeRemovedConventions, (DiscriminatorConvention)discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeRemovedConventions, inversePropertyAttributeConvention); ValueGenerationConvention valueGenerationConvention = new CosmosValueGenerationConvention(Dependencies); conventionSet.EntityTypeBaseTypeChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, (DiscriminatorConvention)discriminatorConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.EntityTypeMemberIgnoredConventions, relationshipDiscoveryConvention); conventionSet.EntityTypePrimaryKeyChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); conventionSet.KeyAddedConventions.Add(storeKeyConvention); conventionSet.KeyRemovedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.KeyRemovedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, relationshipDiscoveryConvention); conventionSet.ForeignKeyRemovedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyRemovedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyPropertiesChangedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyPropertiesChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyUniquenessChangedConventions, keyDiscoveryConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(discriminatorConvention); conventionSet.ForeignKeyOwnershipChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.ForeignKeyOwnershipChangedConventions, keyDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyOwnershipChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyOwnershipChangedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.ForeignKeyNullNavigationSetConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.NavigationAddedConventions, inversePropertyAttributeConvention); ReplaceConvention(conventionSet.NavigationAddedConventions, relationshipDiscoveryConvention); ReplaceConvention(conventionSet.NavigationRemovedConventions, relationshipDiscoveryConvention); ManyToManyJoinEntityTypeConvention manyToManyJoinEntityTypeConvention = new CosmosManyToManyJoinEntityTypeConvention(Dependencies); ReplaceConvention(conventionSet.SkipNavigationAddedConventions, manyToManyJoinEntityTypeConvention); ReplaceConvention(conventionSet.SkipNavigationRemovedConventions, manyToManyJoinEntityTypeConvention); ReplaceConvention(conventionSet.SkipNavigationInverseChangedConventions, manyToManyJoinEntityTypeConvention); ReplaceConvention(conventionSet.SkipNavigationForeignKeyChangedConventions, manyToManyJoinEntityTypeConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(discriminatorConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add(storeKeyConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add((CosmosValueGenerationConvention)valueGenerationConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add((CosmosKeyDiscoveryConvention)keyDiscoveryConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add( (CosmosManyToManyJoinEntityTypeConvention)manyToManyJoinEntityTypeConvention); ReplaceConvention(conventionSet.PropertyAddedConventions, keyDiscoveryConvention); conventionSet.PropertyAnnotationChangedConventions.Add(storeKeyConvention); ReplaceConvention(conventionSet.ModelFinalizingConventions, inversePropertyAttributeConvention); ReplaceConvention( conventionSet.ModelFinalizedConventions, (RuntimeModelConvention) new CosmosRuntimeModelConvention(Dependencies)); return(conventionSet); }