/// <summary> /// Returns the store value generation strategy to set for the given property. /// </summary> /// <param name="property"> The property. </param> /// <returns> The store value generation strategy to set for the given property. </returns> public static new ValueGenerated?GetValueGenerated([NotNull] IProperty property) { var valueGenerated = ValueGenerationConvention.GetValueGenerated(property); if (valueGenerated != null) { return(valueGenerated); } return(property.GetComputedColumnSql() != null ? ValueGenerated.OnAddOrUpdate : property.GetDefaultValue() != null || property.GetDefaultValueSql() != null ? ValueGenerated.OnAdd : (ValueGenerated?)null); }
private static InternalModelBuilder CreateInternalModelBuilder() { var conventions = new ConventionSet(); var dependencies = CreateDependencies(); conventions.EntityTypeAddedConventions.Add(new PropertyDiscoveryConvention(dependencies)); conventions.EntityTypeAddedConventions.Add(new KeyDiscoveryConvention(dependencies)); var keyConvention = new ValueGenerationConvention(dependencies); conventions.ForeignKeyAddedConventions.Add(keyConvention); conventions.ForeignKeyRemovedConventions.Add(keyConvention); conventions.EntityTypePrimaryKeyChangedConventions.Add(keyConvention); return(new InternalModelBuilder(new Model(conventions))); }
private static InternalModelBuilder CreateInternalModelBuilder() { var serviceProvider = InMemoryTestHelpers.Instance.CreateContextServices(); var conventionSet = new ConventionSet(); var dependencies = serviceProvider.GetRequiredService <ProviderConventionSetBuilderDependencies>(); // Use public API to add conventions, issue #214 conventionSet.EntityTypeAddedConventions.Add(new PropertyDiscoveryConvention(dependencies)); conventionSet.EntityTypeAddedConventions.Add(new KeyDiscoveryConvention(dependencies)); var keyConvention = new ValueGenerationConvention(dependencies); conventionSet.ForeignKeyAddedConventions.Add(keyConvention); conventionSet.ForeignKeyRemovedConventions.Add(keyConvention); conventionSet.EntityTypePrimaryKeyChangedConventions.Add(keyConvention); return(new Model(conventionSet, serviceProvider.GetRequiredService <ModelDependencies>()).Builder); }