/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override ConventionSet AddConventions(ConventionSet conventionSet) { Check.NotNull(conventionSet, nameof(conventionSet)); base.AddConventions(conventionSet); var valueGenerationStrategyConvention = new MySqlValueGenerationStrategyConvention(); conventionSet.ModelInitializedConventions.Add(valueGenerationStrategyConvention); conventionSet.ModelInitializedConventions.Add(new RelationalMaxIdentifierLengthConvention(128)); ValueGeneratorConvention valueGeneratorConvention = new MySqlValueGeneratorConvention(); ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention); var mySqlInMemoryTablesConvention = new MySqlMemoryOptimizedTablesConvention(); conventionSet.EntityTypeAnnotationChangedConventions.Add(mySqlInMemoryTablesConvention); ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention); conventionSet.KeyAddedConventions.Add(mySqlInMemoryTablesConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention); var mySqlIndexConvention = new MySqlIndexConvention(_sqlGenerationHelper); conventionSet.BaseEntityTypeChangedConventions.Add(mySqlIndexConvention); conventionSet.ModelBuiltConventions.Add(valueGenerationStrategyConvention); conventionSet.IndexAddedConventions.Add(mySqlInMemoryTablesConvention); conventionSet.IndexAddedConventions.Add(mySqlIndexConvention); conventionSet.IndexUniquenessChangedConventions.Add(mySqlIndexConvention); conventionSet.IndexAnnotationChangedConventions.Add(mySqlIndexConvention); conventionSet.PropertyNullabilityChangedConventions.Add(mySqlIndexConvention); conventionSet.PropertyAnnotationChangedConventions.Add(mySqlIndexConvention); conventionSet.PropertyAnnotationChangedConventions.Add((MySqlValueGeneratorConvention)valueGeneratorConvention); ReplaceConvention(conventionSet.ModelAnnotationChangedConventions, (RelationalDbFunctionConvention) new MySqlDbFunctionConvention()); return(conventionSet); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public override ConventionSet AddConventions(ConventionSet conventionSet) { Check.NotNull(conventionSet, nameof(conventionSet)); base.AddConventions(conventionSet); conventionSet.ModelInitializedConventions.Add(new RelationalMaxIdentifierLengthConvention(64)); ValueGeneratorConvention valueGeneratorConvention = new MySqlValueGeneratorConvention(); ReplaceConvention(conventionSet.BaseEntityTypeChangedConventions, valueGeneratorConvention); ReplaceConvention(conventionSet.PrimaryKeyChangedConventions, valueGeneratorConvention); ReplaceConvention(conventionSet.ForeignKeyAddedConventions, valueGeneratorConvention); ReplaceConvention(conventionSet.ForeignKeyRemovedConventions, valueGeneratorConvention); conventionSet.PropertyAnnotationChangedConventions.Add((MySqlValueGeneratorConvention)valueGeneratorConvention); return(conventionSet); }