Add() public method

public Add ( SqlInsert statement ) : void
statement Serenity.Data.SqlInsert
return void
Beispiel #1
0
        public void CanAddSqlUpdateProperly()
        {
            var script = new DbScript();
            script.Add(new TestRow
            {
                TestId = 1,
                Description = "Test"
            }.ToSqlUpdateById());

            Assert.Equal(TestSqlHelper.Normalize(
                "DECLARE @p1 NVARCHAR(4) = 'Test';" +
                "DECLARE @p2 BIGINT = 1;" +
                "UPDATE Tests SET Description = @p1 WHERE TestId = @p2"),
                TestSqlHelper.Normalize(script.ToString()));
        }
Beispiel #2
0
        public void CanAddSqlInsertProperly()
        {
            var script = new DbScript();
            script.Add(new TestRow
            {
                TrackAssignments = true,
                TestId = 1,
                Description = "Test"
            }.ToSqlInsert());

            Assert.Equal(TestSqlHelper.Normalize(
                "DECLARE @p1 INT = 1;" +
                "DECLARE @p2 NVARCHAR(4) = 'Test';" +
                "INSERT INTO Tests (TestId, Description) VALUES (@p1, @p2)"),
                TestSqlHelper.Normalize(script.ToString()));
        }