protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification)
 {
     commandStringBuilder
         .Append(SqlGenerator.DelimitIdentifier(columnModification.ColumnName))
         .Append(" = ")
         .Append("provider_specific_identity()");
 }
        protected override void AppendIdentityWhereCondition(StringBuilder builder, ColumnModification columnModification)
        {
            Check.NotNull(builder, nameof(builder));
            Check.NotNull(columnModification, nameof(columnModification));

            builder
                .Append(DelimitIdentifier(columnModification.ColumnName))
                .Append(" = ")
                .Append("last_insert_rowid()");
        }
        public void Get_Value_delegates_to_Entry()
        {
            var internalEntryMock = CreateInternalEntryMock(Mock.Of<IProperty>());
            var columnModification = new ColumnModification(
                internalEntryMock.Object,
                new Mock<IProperty>().Object,
                new Mock<IRelationalPropertyAnnotations>().Object,
                new ParameterNameGenerator(),
                isRead: false,
                isWrite: false,
                isKey: false,
                isCondition: false);

            var value = columnModification.Value;

            internalEntryMock.Verify(m => m[It.IsAny<IPropertyBase>()], Times.Once);
        }
        public void Set_Value_delegates_to_Entry()
        {
            var property = new Mock<IProperty>().Object;
            var internalEntryMock = CreateInternalEntryMock(property);
            var columnModification = new ColumnModification(
                internalEntryMock.Object,
                property,
                property.TestProvider(),
                new ParameterNameGenerator(),
                isRead: false,
                isWrite: false,
                isKey: false,
                isCondition: false);
            var value = new object();

            columnModification.Value = value;

            internalEntryMock.VerifySet(m => m[property] = It.IsAny<object>(), Times.Once);
        }
        public void Parameters_return_set_values()
        {
            var columnModification = new ColumnModification(
                CreateInternalEntryMock(Mock.Of<IProperty>()).Object,
                new Mock<IProperty>().Object,
                new Mock<IRelationalPropertyAnnotations>().Object,
                new ParameterNameGenerator(),
                isRead: true,
                isWrite: true,
                isKey: true,
                isCondition: true);

            Assert.Null(columnModification.ColumnName);
            Assert.True(columnModification.IsRead);
            Assert.True(columnModification.IsWrite);
            Assert.True(columnModification.IsKey);
            Assert.True(columnModification.IsCondition);
            Assert.Equal("p0", columnModification.ParameterName);
            Assert.Equal("p1", columnModification.OriginalParameterName);
            Assert.Equal("p2", columnModification.OutputParameterName);
        }
        public void Get_OriginalValue_delegates_to_Entry_if_OriginalValues_if_unavailable()
        {
            var internalEntryMock = CreateInternalEntryMock(Mock.Of<IProperty>());
            var originalValuesMock = new Mock<Sidecar>(internalEntryMock.Object);
            originalValuesMock.Setup(m => m.CanStoreValue(It.IsAny<IPropertyBase>())).Returns(false);
            internalEntryMock.Setup(m => m.OriginalValues).Returns(originalValuesMock.Object);
            var columnModification = new ColumnModification(
                internalEntryMock.Object,
                new Mock<IProperty>().Object,
                new Mock<IRelationalPropertyAnnotations>().Object,
                new ParameterNameGenerator(),
                isRead: false,
                isWrite: false,
                isKey: false,
                isCondition: false);

            var value = columnModification.OriginalValue;

            internalEntryMock.Verify(m => m[It.IsAny<IPropertyBase>()], Times.Once);
            originalValuesMock.Verify(m => m[It.IsAny<IPropertyBase>()], Times.Never);
        }
 public void PopulateParametersBase(DbCommand command, ColumnModification columnModification, IRelationalTypeMapper typeMapper)
 {
     base.PopulateParameters(command, columnModification, typeMapper);
 }
 protected override void PopulateParameters(DbCommand command, ColumnModification columnModification, IRelationalTypeMapper typeMapper)
 {
     PopulateParameterCalls++;
 }
 protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification)
 {
 }
 public void PopulateParametersBase(RelationalCommandBuilder commandBuilder, ColumnModification columnModification)
 {
     base.PopulateParameters(commandBuilder, columnModification);
 }
 protected override void PopulateParameters(RelationalCommandBuilder commandBuilder, ColumnModification columnModification)
 {
     PopulateParameterCalls++;
 }
 protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification)
     => Check.NotNull(commandStringBuilder, nameof(commandStringBuilder))
         .Append(DelimitIdentifier(Check.NotNull(columnModification, nameof(columnModification)).ColumnName))
         .Append(" = ")
         .Append("scope_identity()");
 protected abstract void AppendIdentityWhereCondition(
     [NotNull] StringBuilder commandStringBuilder,
     [NotNull] ColumnModification columnModification);
Beispiel #14
0
 protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification)
 => Check.NotNull(commandStringBuilder, nameof(commandStringBuilder))
 .Append(DelimitIdentifier(Check.NotNull(columnModification, nameof(columnModification)).ColumnName))
 .Append(" = ")
 .Append("scope_identity()");