/// <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); }
public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); var valueGenerationStrategyConvention = new FbValueGenerationStrategyConvention(Dependencies, RelationalDependencies); conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention); conventionSet.ModelInitializedConventions.Add(new RelationalMaxIdentifierLengthConvention(31, Dependencies, RelationalDependencies)); var valueGenerationConvention = new FbValueGenerationConvention(Dependencies, RelationalDependencies); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); ConventionSet.AddBefore(conventionSet.ModelFinalizedConventions, valueGenerationStrategyConvention, typeof(ValidatingConvention)); var storeGenerationConvention = new FbStoreGenerationConvention(Dependencies, RelationalDependencies); ReplaceConvention(conventionSet.PropertyAnnotationChangedConventions, storeGenerationConvention); ReplaceConvention(conventionSet.PropertyAnnotationChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); ReplaceConvention(conventionSet.ModelFinalizedConventions, storeGenerationConvention); return(conventionSet); }
/// <summary> /// Builds and returns the convention set for the current database provider. /// </summary> /// <returns> The convention set for the current database provider. </returns> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); ValueGenerationConvention valueGenerationConvention = new RelationalValueGenerationConvention(Dependencies, RelationalDependencies); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); var relationalColumnAttributeConvention = new RelationalColumnAttributeConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAddedConventions.Add(relationalColumnAttributeConvention); var tableNameFromDbSetConvention = new TableNameFromDbSetConvention(Dependencies, RelationalDependencies); conventionSet.EntityTypeAddedConventions.Add(new RelationalTableAttributeConvention(Dependencies, RelationalDependencies)); conventionSet.EntityTypeAddedConventions.Add(tableNameFromDbSetConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(tableNameFromDbSetConvention); conventionSet.PropertyFieldChangedConventions.Add(relationalColumnAttributeConvention); var storeGenerationConvention = new StoreGenerationConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAnnotationChangedConventions.Add(storeGenerationConvention); conventionSet.PropertyAnnotationChangedConventions.Add((RelationalValueGenerationConvention)valueGenerationConvention); var dbFunctionAttributeConvention = new RelationalDbFunctionAttributeConvention(Dependencies, RelationalDependencies); conventionSet.ModelInitializedConventions.Add(dbFunctionAttributeConvention); conventionSet.ModelAnnotationChangedConventions.Add(dbFunctionAttributeConvention); var sharedTableConvention = new SharedTableConvention(Dependencies, RelationalDependencies); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, storeGenerationConvention, typeof(ValidatingConvention)); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, sharedTableConvention, typeof(ValidatingConvention)); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, new DbFunctionTypeMappingConvention(Dependencies, RelationalDependencies), typeof(ValidatingConvention)); ReplaceConvention( conventionSet.ModelFinalizedConventions, (QueryFilterDefiningQueryRewritingConvention) new RelationalQueryFilterDefiningQueryRewritingConvention( Dependencies, RelationalDependencies)); return(conventionSet); }
/// <summary> /// Builds and returns the convention set for the current database provider. /// </summary> /// <returns> The convention set for the current database provider. </returns> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); var valueGenerationStrategyConvention = new AseValueGenerationStrategyConvention(Dependencies, RelationalDependencies); conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention); conventionSet.ModelInitializedConventions.Add( new RelationalMaxIdentifierLengthConvention(128, Dependencies, RelationalDependencies)); //ValueGenerationConvention valueGenerationConvention = // new AseValueGenerationConvention(Dependencies, RelationalDependencies); //ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); //var AseInMemoryTablesConvention = new AseMemoryOptimizedTablesConvention(Dependencies, RelationalDependencies); //conventionSet.EntityTypeAnnotationChangedConventions.Add(AseInMemoryTablesConvention); //ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); //conventionSet.KeyAddedConventions.Add(AseInMemoryTablesConvention); //ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); //ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); var aseIndexConvention = new AseIndexConvention(Dependencies, RelationalDependencies, _sqlGenerationHelper); conventionSet.EntityTypeBaseTypeChangedConventions.Add(aseIndexConvention); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, valueGenerationStrategyConvention, typeof(ValidatingConvention)); //conventionSet.IndexAddedConventions.Add(AseInMemoryTablesConvention); conventionSet.IndexAddedConventions.Add(aseIndexConvention); conventionSet.IndexUniquenessChangedConventions.Add(aseIndexConvention); conventionSet.IndexAnnotationChangedConventions.Add(aseIndexConvention); conventionSet.PropertyNullabilityChangedConventions.Add(aseIndexConvention); //StoreGenerationConvention storeGenerationConvention = // new AseStoreGenerationConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAnnotationChangedConventions.Add(aseIndexConvention); //ReplaceConvention(conventionSet.PropertyAnnotationChangedConventions, storeGenerationConvention); //ReplaceConvention( // conventionSet.PropertyAnnotationChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); //ReplaceConvention(conventionSet.ModelFinalizedConventions, storeGenerationConvention); 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 virtual ConventionSet ModifyConventions(ConventionSet conventionSet) { ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, new ProxyBindingRewriter( _proxyFactory, _options.FindExtension <ProxiesOptionsExtension>(), _lazyLoaderParameterBindingFactoryDependencies, _conventionSetBuilderDependencies), typeof(ValidatingConvention)); 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 virtual ConventionSet ModifyConventions(ConventionSet conventionSet) { var extension = _options.FindExtension <ProxiesOptionsExtension>(); ConventionSet.AddAfter( conventionSet.ModelInitializedConventions, new ProxyChangeTrackingConvention(extension), typeof(DbSetFindingConvention)); ConventionSet.AddBefore( conventionSet.ModelFinalizedConventions, new ProxyBindingRewriter( _proxyFactory, extension, _lazyLoaderParameterBindingFactoryDependencies, _conventionSetBuilderDependencies), typeof(ValidatingConvention)); return(conventionSet); }
/// <summary> /// Builds and returns the convention set for the current database provider. /// </summary> /// <returns>The convention set for the current database provider.</returns> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); var valueGenerationStrategyConvention = new SqlServerValueGenerationStrategyConvention(Dependencies, RelationalDependencies); conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention); conventionSet.ModelInitializedConventions.Add( new RelationalMaxIdentifierLengthConvention(128, Dependencies, RelationalDependencies)); ValueGenerationConvention valueGenerationConvention = new SqlServerValueGenerationConvention(Dependencies, RelationalDependencies); var sqlServerIndexConvention = new SqlServerIndexConvention(Dependencies, RelationalDependencies, _sqlGenerationHelper); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(sqlServerIndexConvention); var sqlServerInMemoryTablesConvention = new SqlServerMemoryOptimizedTablesConvention(Dependencies, RelationalDependencies); conventionSet.EntityTypeAnnotationChangedConventions.Add(sqlServerInMemoryTablesConvention); ReplaceConvention( conventionSet.ForeignKeyPropertiesChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); ReplaceConvention( conventionSet.ForeignKeyOwnershipChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); ReplaceConvention( conventionSet.EntityTypeAnnotationChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); var sqlServerTemporalConvention = new SqlServerTemporalConvention(Dependencies, RelationalDependencies); ConventionSet.AddBefore( conventionSet.EntityTypeAnnotationChangedConventions, sqlServerTemporalConvention, typeof(SqlServerValueGenerationConvention)); ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); conventionSet.KeyAddedConventions.Add(sqlServerInMemoryTablesConvention); var sqlServerOnDeleteConvention = new SqlServerOnDeleteConvention(Dependencies, RelationalDependencies); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, (CascadeDeleteConvention)sqlServerOnDeleteConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyRequirednessChangedConventions, (CascadeDeleteConvention)sqlServerOnDeleteConvention); conventionSet.SkipNavigationForeignKeyChangedConventions.Add(sqlServerOnDeleteConvention); conventionSet.IndexAddedConventions.Add(sqlServerInMemoryTablesConvention); conventionSet.IndexAddedConventions.Add(sqlServerIndexConvention); conventionSet.IndexUniquenessChangedConventions.Add(sqlServerIndexConvention); conventionSet.IndexAnnotationChangedConventions.Add(sqlServerIndexConvention); conventionSet.PropertyNullabilityChangedConventions.Add(sqlServerIndexConvention); StoreGenerationConvention storeGenerationConvention = new SqlServerStoreGenerationConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAnnotationChangedConventions.Add(sqlServerIndexConvention); ReplaceConvention(conventionSet.PropertyAnnotationChangedConventions, storeGenerationConvention); ReplaceConvention( conventionSet.PropertyAnnotationChangedConventions, (RelationalValueGenerationConvention)valueGenerationConvention); conventionSet.ModelFinalizingConventions.Add(valueGenerationStrategyConvention); ReplaceConvention(conventionSet.ModelFinalizingConventions, storeGenerationConvention); ReplaceConvention( conventionSet.ModelFinalizingConventions, (SharedTableConvention) new SqlServerSharedTableConvention(Dependencies, RelationalDependencies)); conventionSet.ModelFinalizingConventions.Add(new SqlServerDbFunctionConvention(Dependencies, RelationalDependencies)); ReplaceConvention( conventionSet.ModelFinalizedConventions, (RuntimeModelConvention) new SqlServerRuntimeModelConvention(Dependencies, RelationalDependencies)); conventionSet.SkipNavigationForeignKeyChangedConventions.Add(sqlServerTemporalConvention); return(conventionSet); }
/// <summary> /// Builds and returns the convention set for the current database provider. /// </summary> /// <returns> The convention set for the current database provider. </returns> public override ConventionSet CreateConventionSet() { var conventionSet = base.CreateConventionSet(); var relationalColumnAttributeConvention = new RelationalColumnAttributeConvention(Dependencies, RelationalDependencies); var relationalCommentAttributeConvention = new RelationalColumnCommentAttributeConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAddedConventions.Add(relationalColumnAttributeConvention); conventionSet.PropertyAddedConventions.Add(relationalCommentAttributeConvention); var tableNameFromDbSetConvention = new TableNameFromDbSetConvention(Dependencies, RelationalDependencies); conventionSet.EntityTypeAddedConventions.Add(new RelationalTableAttributeConvention(Dependencies, RelationalDependencies)); conventionSet.EntityTypeAddedConventions.Add( new RelationalTableCommentAttributeConvention(Dependencies, RelationalDependencies)); conventionSet.EntityTypeAddedConventions.Add(tableNameFromDbSetConvention); ValueGenerationConvention valueGenerationConvention = new RelationalValueGenerationConvention(Dependencies, RelationalDependencies); ReplaceConvention(conventionSet.EntityTypeBaseTypeChangedConventions, valueGenerationConvention); conventionSet.EntityTypeBaseTypeChangedConventions.Add(tableNameFromDbSetConvention); conventionSet.EntityTypeAnnotationChangedConventions.Add((RelationalValueGenerationConvention)valueGenerationConvention); ReplaceConvention(conventionSet.EntityTypePrimaryKeyChangedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGenerationConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGenerationConvention); conventionSet.PropertyFieldChangedConventions.Add(relationalColumnAttributeConvention); conventionSet.PropertyFieldChangedConventions.Add(relationalCommentAttributeConvention); var storeGenerationConvention = new StoreGenerationConvention(Dependencies, RelationalDependencies); conventionSet.PropertyAnnotationChangedConventions.Add(storeGenerationConvention); conventionSet.PropertyAnnotationChangedConventions.Add((RelationalValueGenerationConvention)valueGenerationConvention); var dbFunctionAttributeConvention = new RelationalDbFunctionAttributeConvention(Dependencies, RelationalDependencies); conventionSet.ModelInitializedConventions.Add(dbFunctionAttributeConvention); // Use TypeMappingConvention to add the relational store type mapping // to the generated concurrency token property ConventionSet.AddBefore( conventionSet.ModelFinalizingConventions, new TableSharingConcurrencyTokenConvention(Dependencies, RelationalDependencies), typeof(TypeMappingConvention)); // ModelCleanupConvention would remove the entity types added by TableValuedDbFunctionConvention #15898 ConventionSet.AddAfter( conventionSet.ModelFinalizingConventions, new TableValuedDbFunctionConvention(Dependencies, RelationalDependencies), typeof(ModelCleanupConvention)); conventionSet.ModelFinalizingConventions.Add(dbFunctionAttributeConvention); conventionSet.ModelFinalizingConventions.Add(tableNameFromDbSetConvention); conventionSet.ModelFinalizingConventions.Add(storeGenerationConvention); conventionSet.ModelFinalizingConventions.Add(new EntityTypeHierarchyMappingConvention(Dependencies, RelationalDependencies)); conventionSet.ModelFinalizingConventions.Add(new SequenceUniquificationConvention(Dependencies, RelationalDependencies)); conventionSet.ModelFinalizingConventions.Add(new SharedTableConvention(Dependencies, RelationalDependencies)); conventionSet.ModelFinalizingConventions.Add(new DbFunctionTypeMappingConvention(Dependencies, RelationalDependencies)); ReplaceConvention( conventionSet.ModelFinalizingConventions, (QueryFilterRewritingConvention) new RelationalQueryFilterRewritingConvention( Dependencies, RelationalDependencies)); ConventionSet.AddAfter( conventionSet.ModelFinalizedConventions, new RelationalModelConvention(Dependencies, RelationalDependencies), typeof(ValidatingConvention)); return(conventionSet); }