public void Default_Sequence_name_is_used_if_not_set_anywhere()
        {
            var property = CreateProperty();

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor());

            Assert.Equal("MyTable_Sequence", factory.GetSequenceName(property));
        }
        public void Sequence_name_is_obtained_from_model_annotation_if_not_set_on_property_or_type()
        {
            var property = CreateProperty();

            property.EntityType.Model["StoreSequenceName"] = "Robert";

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor());

            Assert.Equal("Robert", factory.GetSequenceName(property));
        }
        public void Sequence_name_is_obtained_from_entity_type_annotation_if_not_set_on_property()
        {
            var property = CreateProperty();
            property.EntityType["StoreSequenceName"] = "Robert";
            property.EntityType.Model["StoreSequenceName"] = "Jimmy";

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor());

            Assert.Equal("Robert", factory.GetSequenceName(property));
        }
        public void Schema_qualified_sequence_name_is_obtained_from_named_sequence()
        {
            var property = new ModelBuilder()
                           .Entity <Robot>()
                           .Property(e => e.Id)
                           .ForSqlServer(b => b.UseSequence("DaneelOlivaw", "R"))
                           .Metadata;

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor(new LoggerFactory()));

            Assert.Equal("R.DaneelOlivaw", factory.GetSequenceName(property));
        }
        public void Sequence_name_is_obtained_from_default_sequence()
        {
            var property = new ModelBuilder()
                           .Entity <Robot>()
                           .Property(e => e.Id)
                           .ForSqlServer(b => b.UseSequence())
                           .Metadata;

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor(new LoggerFactory()));

            Assert.Equal("EntityFrameworkDefaultSequence", factory.GetSequenceName(property));
        }
Beispiel #6
0
        public void Sequence_name_is_obtained_from_specified_sequence()
        {
            var property = CreateConventionModelBuilder()
                           .ForSqlServer(b => b.Sequence("DaneelOlivaw").IncrementBy(11))
                           .Entity <Robot>()
                           .Property(e => e.Id)
                           .ForSqlServer(b => b.UseSequence("DaneelOlivaw"))
                           .Metadata;

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor(new LoggerFactory()));

            Assert.Equal("DaneelOlivaw", factory.GetSequenceName(property));
        }
Beispiel #7
0
        public void Sequence_name_is_obtained_from_model_specified_model_default_sequence()
        {
            var property = CreateConventionModelBuilder()
                           .ForSqlServer(b =>
            {
                b.UseSequence();
                b.Sequence().IncrementBy(11);
            })
                           .Entity <Robot>()
                           .Property(e => e.Id)
                           .GenerateValueOnAdd()
                           .Metadata;

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor(new LoggerFactory()));

            Assert.Equal("EntityFrameworkDefaultSequence", factory.GetSequenceName(property));
        }
        public void Default_Sequence_name_is_used_if_not_set_anywhere()
        {
            var property = CreateProperty();

            var factory = new SqlServerSequenceValueGeneratorFactory(new SqlStatementExecutor());

            Assert.Equal("MyTable_Sequence", factory.GetSequenceName(property));
        }