public virtual InternalModelBuilder Apply(InternalModelBuilder modelBuilder) { modelBuilder.Annotation( SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.ValueGeneration, SqlServerValueGenerationStrategy.Sequence.ToString(), ConfigurationSource.Convention); var sequence = new Sequence(Sequence.DefaultName) { Model = modelBuilder.Metadata }; modelBuilder.Annotation( SqlServerAnnotationNames.Prefix + RelationalAnnotationNames.Sequence + sequence.Schema + "." + sequence.Name, sequence.Serialize(), ConfigurationSource.Convention ); modelBuilder.Annotation( SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.DefaultSequenceName, sequence.Name, ConfigurationSource.Convention); modelBuilder.Annotation( SqlServerAnnotationNames.Prefix + SqlServerAnnotationNames.DefaultSequenceSchema, sequence.Schema, ConfigurationSource.Convention); return modelBuilder; }
private static void ValidateSchemaNamedSequence(Sequence sequence) { Assert.Equal("Snook", sequence.Name); Assert.Equal("Tasty", sequence.Schema); Assert.Equal(Sequence.DefaultIncrement, sequence.IncrementBy); Assert.Equal(Sequence.DefaultStartValue, sequence.StartValue); Assert.Null(sequence.MinValue); Assert.Null(sequence.MaxValue); Assert.Same(Sequence.DefaultType, sequence.Type); }
private static void ValidateDefaultSequence(Sequence sequence) { Assert.Equal(Sequence.DefaultName, sequence.Name); Assert.Null(sequence.Schema); Assert.Equal(Sequence.DefaultIncrement, sequence.IncrementBy); Assert.Equal(Sequence.DefaultStartValue, sequence.StartValue); Assert.Same(Sequence.DefaultType, sequence.Type); }
private static void ValidateNamedSpecificSequence(Sequence sequence) { Assert.Equal("Snook", sequence.Name); Assert.Null(sequence.Schema); Assert.Equal(11, sequence.IncrementBy); Assert.Equal(1729, sequence.StartValue); Assert.Equal(111, sequence.MinValue); Assert.Equal(2222, sequence.MaxValue); Assert.Same(typeof(int), sequence.Type); }