Beispiel #1
0
        public void CurdAllField()
        {
            NpgsqlConnection.GlobalTypeMapper.UseLegacyPostgis();

            var sql1 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();
            var sql2 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();

            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBitArray              = new BitArray(Encoding.UTF8.GetBytes("我是")),
                testFieldBitArrayArray         = new[] { new BitArray(Encoding.UTF8.GetBytes("中国")), new BitArray(Encoding.UTF8.GetBytes("公民")) },
                testFieldBool                  = true,
                testFieldBoolArray             = new[] { true, true, false, false },
                testFieldBoolArrayNullable     = new bool?[] { true, true, null, false, false },
                testFieldBoolNullable          = true,
                testFieldByte                  = byte.MaxValue,
                testFieldByteArray             = new byte[] { 0, 1, 2, 3, 4, 5, 6 },
                testFieldByteArrayNullable     = new byte?[] { 0, 1, 2, 3, null, 4, 5, 6 },
                testFieldByteNullable          = byte.MinValue,
                testFieldBytes                 = Encoding.UTF8.GetBytes("我是中国人"),
                testFieldBytesArray            = new[] { Encoding.UTF8.GetBytes("我是中国人"), Encoding.UTF8.GetBytes("我是中国人") },
                testFieldCidr                  = (IPAddress.Parse("10.0.0.0"), 8),
                testFieldCidrArray             = new[] { (IPAddress.Parse("10.0.0.0"), 8), (IPAddress.Parse("192.168.0.0"), 16) },
Beispiel #2
0
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                Bool             = true,
                BoolNullable     = true,
                Byte             = 255,
                ByteNullable     = 127,
                Bytes            = Encoding.UTF8.GetBytes("我是中国人"),
                DateTime         = DateTime.Now,
                DateTimeNullable = DateTime.Now.AddHours(-1),
                Decimal          = 99.99M,
                DecimalNullable  = 99.98M,
                Double           = 999.99,
                DoubleNullable   = 999.98,
                Enum1            = TableAllTypeEnumType1.e5,
                Enum1Nullable    = TableAllTypeEnumType1.e3,
                Enum2            = TableAllTypeEnumType2.f2,
                Enum2Nullable    = TableAllTypeEnumType2.f3,
                Float            = 19.99F,
                FloatNullable    = 19.98F,
                Guid             = Guid.NewGuid(),
                GuidNullable     = Guid.NewGuid(),
                Int                  = int.MaxValue,
                IntNullable          = int.MinValue,
                SByte                = 100,
                SByteNullable        = 99,
                Short                = short.MaxValue,
                ShortNullable        = short.MinValue,
                String               = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
                TimeSpan             = TimeSpan.FromSeconds(999),
                TimeSpanNullable     = TimeSpan.FromSeconds(60),
                UInt                 = uint.MaxValue,
                UIntNullable         = uint.MinValue,
                ULong                = ulong.MaxValue - 10000000,
                ULongNullable        = ulong.MinValue,
                UShort               = ushort.MaxValue,
                UShortNullable       = ushort.MinValue,
                testFielLongNullable = long.MinValue
            };

            item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
            var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();

            Assert.Equal(item2.String, newitem2.String);

            item2.Id = (int)insert.NoneParameter().AppendData(item2).ExecuteIdentity();
            newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
            Assert.Equal(item2.String, newitem2.String);

            var items   = select.ToList();
            var itemstb = select.ToDataTable();
        }
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool             = true,
                testFieldBoolNullable     = true,
                testFieldByte             = byte.MaxValue,
                testFieldByteNullable     = byte.MinValue,
                testFieldBytes            = Encoding.UTF8.GetBytes("我是中国人"),
                testFieldDateTime         = DateTime.Now,
                testFieldDateTimeNullable = DateTime.Now.AddDays(-1),
                testFieldDecimal          = 999.99M,
                testFieldDecimalNullable  = 111.11M,
                testFieldDouble           = 888.88,
                testFieldDoubleNullable   = 222.22,
                testFieldEnum1            = TableAllTypeEnumType1.e3,
                testFieldEnum1Nullable    = TableAllTypeEnumType1.e2,
                testFieldEnum2            = TableAllTypeEnumType2.f2,
                testFieldEnum2Nullable    = TableAllTypeEnumType2.f3,
                testFieldFloat            = 777.77F,
                testFieldFloatNullable    = 333.33F,
                testFieldGuid             = Guid.NewGuid(),
                testFieldGuidNullable     = Guid.NewGuid(),
                testFieldInt         = int.MaxValue,
                testFieldIntNullable = 123,
                testFieldLong        = long.MaxValue,

                testFieldSByte            = sbyte.MaxValue,
                testFieldSByteNullable    = sbyte.MinValue,
                testFieldShort            = short.MaxValue,
                testFieldShortNullable    = short.MinValue,
                testFieldString           = "我是中国人String",
                testFieldTimeSpan         = TimeSpan.FromDays(1),
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(90),
                testFieldUInt             = uint.MaxValue,
                testFieldUIntNullable     = uint.MinValue,
                testFieldULong            = ulong.MaxValue,
                testFieldULongNullable    = ulong.MinValue,
                testFieldUShort           = ushort.MaxValue,
                testFieldUShortNullable   = ushort.MinValue,
                testFielLongNullable      = long.MinValue,
            };

            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();
            var item3NP = insert.AppendData(item2).NoneParameter().ExecuteInserted();

            var item3    = insert.AppendData(item2).ExecuteInserted().First();
            var newitem2 = select.Where(a => a.Id == item3.Id).ToOne();

            var items = select.ToList();
        }
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool                   = true,
                testFieldBoolNullable           = true,
                testFieldByte                   = byte.MaxValue,
                testFieldByteNullable           = byte.MinValue,
                testFieldBytes                  = Encoding.GetEncoding("gb2312").GetBytes("我是中国人"),
                testFieldDateTime               = DateTime.Now,
                testFieldDateTimeNullable       = DateTime.Now.AddHours(1),
                testFieldDateTimeNullableOffset = new DateTimeOffset(DateTime.Now.AddHours(1), TimeSpan.FromHours(8)),
                testFieldDateTimeOffset         = new DateTimeOffset(DateTime.Now, TimeSpan.FromHours(8)),
                testFieldDecimal                = 998.99M,
                testFieldDecimalNullable        = 999.12M,
                testFieldDouble                 = 99.199,
                testFieldDoubleNullable         = 99.211,
                testFieldEnum1                  = TableAllTypeEnumType1.e2,
                testFieldEnum1Nullable          = TableAllTypeEnumType1.e3,
                testFieldEnum2                  = TableAllTypeEnumType2.f3,
                testFieldEnum2Nullable          = TableAllTypeEnumType2.f2,
                testFieldFloat                  = 0.99F,
                testFieldFloatNullable          = 0.11F,
                testFieldGuid                   = Guid.NewGuid(),
                testFieldGuidNullable           = Guid.NewGuid(),
                testFieldInt              = int.MaxValue,
                testFieldIntNullable      = int.MinValue,
                testFieldLong             = long.MaxValue,
                testFieldSByte            = sbyte.MaxValue,
                testFieldSByteNullable    = sbyte.MinValue,
                testFieldShort            = short.MaxValue,
                testFieldShortNullable    = short.MinValue,
                testFieldString           = "我是中国人string",
                testFieldTimeSpan         = TimeSpan.FromSeconds(999),
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(30),
                testFieldUInt             = uint.MaxValue,
                testFieldUIntNullable     = uint.MinValue,
                testFieldULong            = ulong.MaxValue,
                testFieldULongNullable    = ulong.MinValue,
                testFieldUShort           = ushort.MaxValue,
                testFieldUShortNullable   = ushort.MinValue,
                testFielLongNullable      = long.MinValue
            };

            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();

            var item3    = insert.AppendData(item2).ExecuteInserted();
            var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();

            var items = select.ToList();
        }
Beispiel #5
0
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool             = true,
                testFieldBoolNullable     = true,
                testFieldByte             = 255,
                testFieldByteNullable     = 127,
                testFieldBytes            = Encoding.UTF8.GetBytes("我是中国人"),
                testFieldDateTime         = DateTime.Now,
                testFieldDateTimeNullable = DateTime.Now.AddHours(-1),
                testFieldDecimal          = 99.99M,
                testFieldDecimalNullable  = 99.98M,
                testFieldDouble           = 999.99,
                testFieldDoubleNullable   = 999.98,
                testFieldEnum1            = TableAllTypeEnumType1.e5,
                testFieldEnum1Nullable    = TableAllTypeEnumType1.e3,
                testFieldEnum2            = TableAllTypeEnumType2.f2,
                testFieldEnum2Nullable    = TableAllTypeEnumType2.f3,
                testFieldFloat            = 19.99F,
                testFieldFloatNullable    = 19.98F,
                testFieldGuid             = Guid.NewGuid(),
                testFieldGuidNullable     = Guid.NewGuid(),
                testFieldInt              = int.MaxValue,
                testFieldIntNullable      = int.MinValue,
                testFieldSByte            = 100,
                testFieldSByteNullable    = 99,
                testFieldShort            = short.MaxValue,
                testFieldShortNullable    = short.MinValue,
                testFieldString           = "我是中国人string",
                testFieldTimeSpan         = TimeSpan.FromSeconds(999),
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(60),
                testFieldUInt             = uint.MaxValue,
                testFieldUIntNullable     = uint.MinValue,
                testFieldULong            = ulong.MaxValue,
                testFieldULongNullable    = ulong.MinValue,
                testFieldUShort           = ushort.MaxValue,
                testFieldUShortNullable   = ushort.MinValue,
                testFielLongNullable      = long.MinValue
            };
            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();
            var item3NP = insert.AppendData(item2).NoneParameter().ExecuteIdentity();

            var enumConvInt = select.Where(a => a.Id == (int)TableAllTypeEnumType1.e1).ToSql();

            item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
            var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();

            var items = select.ToList();
        }
Beispiel #6
0
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool             = true,
                testFieldBoolNullable     = true,
                testFieldByte             = 255,
                testFieldByteNullable     = 127,
                testFieldBytes            = Encoding.UTF8.GetBytes("我是中国人"),
                testFieldDateTime         = DateTime.Now,
                testFieldDateTimeNullable = DateTime.Now.AddHours(-1),
                testFieldDecimal          = 99.99M,
                testFieldDecimalNullable  = 99.98M,
                testFieldDouble           = 999.99,
                testFieldDoubleNullable   = 999.98,
                testFieldEnum1            = TableAllTypeEnumType1.e5,
                testFieldEnum1Nullable    = TableAllTypeEnumType1.e3,
                testFieldEnum2            = TableAllTypeEnumType2.f2,
                testFieldEnum2Nullable    = TableAllTypeEnumType2.f3,
                testFieldFloat            = 19.99F,
                testFieldFloatNullable    = 19.98F,
                testFieldGuid             = Guid.NewGuid(),
                testFieldGuidNullable     = Guid.NewGuid(),
                testFieldInt             = int.MaxValue,
                testFieldIntNullable     = int.MinValue,
                testFieldLineString      = new MygisLineString(new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10) }),
                testFieldLong            = long.MaxValue,
                testFieldMultiLineString = new MygisMultiLineString(new[] {
                    new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10) },
                    new[] { new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 100) }
                }),
                testFieldMultiPoint   = new MygisMultiPoint(new[] { new MygisCoordinate2D(11, 11), new MygisCoordinate2D(51, 11) }),
                testFieldMultiPolygon = new MygisMultiPolygon(new[] {
                    new MygisPolygon(new[] {
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) }
                    }),
                    new MygisPolygon(new[] {
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                        new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) }
                    })
                }),
                testFieldPoint   = new MygisPoint(99, 99),
                testFieldPolygon = new MygisPolygon(new[] {
                    new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                    new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                    new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) },
                    new[] { new MygisCoordinate2D(10, 10), new MygisCoordinate2D(50, 10), new MygisCoordinate2D(10, 50), new MygisCoordinate2D(10, 10) }
                }),
                testFieldSByte            = 100,
                testFieldSByteNullable    = 99,
                testFieldShort            = short.MaxValue,
                testFieldShortNullable    = short.MinValue,
                testFieldString           = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
                testFieldTimeSpan         = TimeSpan.FromSeconds(999),
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(60),
                testFieldUInt             = uint.MaxValue,
                testFieldUIntNullable     = uint.MinValue,
                testFieldULong            = ulong.MaxValue,
                testFieldULongNullable    = ulong.MinValue,
                testFieldUShort           = ushort.MaxValue,
                testFieldUShortNullable   = ushort.MinValue,
                testFielLongNullable      = long.MinValue
            };

            item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
            var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();

            Assert.Equal(item2.testFieldString, newitem2.testFieldString);

            item2.Id = (int)insert.NoneParameter().AppendData(item2).ExecuteIdentity();
            newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
            Assert.Equal(item2.testFieldString, newitem2.testFieldString);

            var items = select.ToList();
        }
Beispiel #7
0
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            for (var a = 0; a < 100; a++)
            {
                try //ERROR [23000] [Oracle][ODBC][Ora]ORA-00001: 违反唯一约束条件 (1ODBC.1ODBC_TB_ALLTYPE_pk2)
                {
                    item.Id = (int)insert.AppendData(item).ExecuteIdentity();
                    break;
                }
                catch
                {
                }
            }

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                Bool             = true,
                BoolNullable     = true,
                Byte             = 255,
                ByteNullable     = 127,
                Bytes            = Encoding.UTF8.GetBytes("我是中国人"),
                DateTime         = DateTime.Now,
                DateTimeNullable = DateTime.Now.AddHours(-1),
                Decimal          = 99.99M,
                DecimalNullable  = 99.98M,
                Double           = 999.99,
                DoubleNullable   = 999.98,
                Enum1            = TableAllTypeEnumType1.e5,
                Enum1Nullable    = TableAllTypeEnumType1.e3,
                Enum2            = TableAllTypeEnumType2.f2,
                Enum2Nullable    = TableAllTypeEnumType2.f3,
                Float            = 19.99F,
                FloatNullable    = 19.98F,
                Guid             = Guid.NewGuid(),
                GuidNullable     = Guid.NewGuid(),
                Int                  = int.MaxValue,
                IntNullable          = int.MinValue,
                SByte                = 100,
                SByteNullable        = 99,
                Short                = short.MaxValue,
                ShortNullable        = short.MinValue,
                String               = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
                Char                 = 'X',
                TimeSpan             = TimeSpan.FromSeconds(999),
                TimeSpanNullable     = TimeSpan.FromSeconds(60),
                UInt                 = uint.MaxValue,
                UIntNullable         = uint.MinValue,
                ULong                = ulong.MaxValue,
                ULongNullable        = ulong.MinValue,
                UShort               = ushort.MaxValue,
                UShortNullable       = ushort.MinValue,
                testFielLongNullable = long.MinValue
            };
            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();
            var item3NP = insert.AppendData(item2).NoneParameter().ExecuteIdentity();

            item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
            var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();

            Assert.Equal(item2.String, newitem2.String);
            Assert.Equal(item2.Char, newitem2.Char);

            item2.Id = (int)insert.NoneParameter().AppendData(item2).ExecuteIdentity();
            newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
            Assert.Equal(item2.String, newitem2.String);
            Assert.Equal(item2.Char, newitem2.Char);

            var items   = select.ToList();
            var itemstb = select.ToDataTable();
        }
        public void CurdAllField()
        {
            //var sql1 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();
            //var sql2 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();

            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool = true,
                //testFieldBoolArray = new[] { true, true, false, false },
                //testFieldBoolArrayNullable = new bool?[] { true, true, null, false, false },
                testFieldBoolNullable = true,
                testFieldByte         = byte.MaxValue,
                //testFieldByteArray = new byte[] { 0, 1, 2, 3, 4, 5, 6 },
                //testFieldByteArrayNullable = new byte?[] { 0, 1, 2, 3, null, 4, 5, 6 },
                testFieldByteNullable = byte.MinValue,
                testFieldBytes        = Encoding.UTF8.GetBytes("我是中国人"),
                //testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("我是中国人"), Encoding.UTF8.GetBytes("我是中国人") },
                testFieldDateTime = DateTime.Now,
                //testFieldDateTimeArray = new[] { DateTime.Now, DateTime.Now.AddHours(2) },
                //testFieldDateTimeArrayNullable = new DateTime?[] { DateTime.Now, null, DateTime.Now.AddHours(2) },
                testFieldDateTimeNullable = DateTime.Now.AddDays(-1),
                testFieldDecimal          = 999.99M,
                //testFieldDecimalArray = new[] { 999.91M, 999.92M, 999.93M },
                //testFieldDecimalArrayNullable = new decimal?[] { 998.11M, 998.12M, 998.13M },
                testFieldDecimalNullable = 111.11M,
                testFieldDouble          = 888.88,
                //testFieldDoubleArray = new[] { 888.81, 888.82, 888.83 },
                //testFieldDoubleArrayNullable = new double?[] { 888.11, 888.12, null, 888.13 },
                testFieldDoubleNullable = 222.22,
                testFieldEnum1          = TableAllTypeEnumType1.e3,
                //testFieldEnum1Array = new[] { TableAllTypeEnumType1.e5, TableAllTypeEnumType1.e2, TableAllTypeEnumType1.e1 },
                //testFieldEnum1ArrayNullable = new TableAllTypeEnumType1?[] { TableAllTypeEnumType1.e5, TableAllTypeEnumType1.e2, null, TableAllTypeEnumType1.e1 },
                testFieldEnum1Nullable = TableAllTypeEnumType1.e2,
                testFieldEnum2         = TableAllTypeEnumType2.f2,
                //testFieldEnum2Array = new[] { TableAllTypeEnumType2.f3, TableAllTypeEnumType2.f1 },
                //testFieldEnum2ArrayNullable = new TableAllTypeEnumType2?[] { TableAllTypeEnumType2.f3, null, TableAllTypeEnumType2.f1 },
                testFieldEnum2Nullable = TableAllTypeEnumType2.f3,
                testFieldFloat         = 777.77F,
                //testFieldFloatArray = new[] { 777.71F, 777.72F, 777.73F },
                //testFieldFloatArrayNullable = new float?[] { 777.71F, 777.72F, null, 777.73F },
                testFieldFloatNullable = 333.33F,
                testFieldGuid          = Guid.NewGuid(),
                //testFieldGuidArray = new[] { Guid.NewGuid(), Guid.NewGuid() },
                //testFieldGuidArrayNullable = new Guid?[] { Guid.NewGuid(), null, Guid.NewGuid() },
                testFieldGuidNullable = Guid.NewGuid(),
                testFieldInt          = int.MaxValue,
                //testFieldIntArray = new[] { 1, 2, 3, 4, 5 },
                //testFieldIntArrayNullable = new int?[] { 1, 2, 3, null, 4, 5 },
                testFieldIntNullable = int.MinValue,
                testFieldLong        = long.MaxValue,
                //testFieldLongArray = new long[] { 10, 20, 30, 40, 50 },
                testFieldSByte = sbyte.MaxValue,
                //testFieldSByteArray = new sbyte[] { 1, 2, 3, 4, 5 },
                //testFieldSByteArrayNullable = new sbyte?[] { 1, 2, 3, null, 4, 5 },
                testFieldSByteNullable = sbyte.MinValue,
                testFieldShort         = short.MaxValue,
                //testFieldShortArray = new short[] { 1, 2, 3, 4, 5 },
                //testFieldShortArrayNullable = new short?[] { 1, 2, 3, null, 4, 5 },
                testFieldShortNullable = short.MinValue,
                testFieldString        = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
                testFieldChar          = 'X',
                //testFieldStringArray = new[] { "我是中国人String1", "我是中国人String2", null, "我是中国人String3" },
                testFieldTimeSpan = TimeSpan.FromHours(10),
                //testFieldTimeSpanArray = new[] { TimeSpan.FromHours(10), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60) },
                //testFieldTimeSpanArrayNullable = new TimeSpan?[] { TimeSpan.FromHours(10), TimeSpan.FromSeconds(10), null, TimeSpan.FromSeconds(60) },
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(90),
                testFieldUInt             = uint.MaxValue,
                //testFieldUIntArray = new uint[] { 1, 2, 3, 4, 5 },
                //testFieldUIntArrayNullable = new uint?[] { 1, 2, 3, null, 4, 5 },
                testFieldUIntNullable = uint.MinValue,
                testFieldULong        = ulong.MaxValue,
                //testFieldULongArray = new ulong[] { 10, 20, 30, 40, 50 },
                //testFieldULongArrayNullable = new ulong?[] { 10, 20, 30, null, 40, 50 },
                testFieldULongNullable = ulong.MinValue,
                testFieldUShort        = ushort.MaxValue,
                //testFieldUShortArray = new ushort[] { 11, 12, 13, 14, 15 },
                //testFieldUShortArrayNullable = new ushort?[] { 11, 12, 13, null, 14, 15 },
                testFieldUShortNullable = ushort.MinValue,
                //testFielLongArrayNullable = new long?[] { 500, 600, 700, null, 999, 1000 },
                testFielLongNullable = long.MinValue
            };

            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();
            var item3NP = insert.AppendData(item2).NoneParameter().ExecuteInserted();

            var item3    = insert.AppendData(item2).ExecuteInserted().First();
            var newitem2 = select.Where(a => a.Id == item3.Id).ToOne();

            Assert.Equal(item2.testFieldString, newitem2.testFieldString);
            Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);

            item3    = insert.NoneParameter().AppendData(item2).ExecuteInserted().First();
            newitem2 = select.Where(a => a.Id == item3.Id).ToOne();
            Assert.Equal(item2.testFieldString, newitem2.testFieldString);
            Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);

            var items   = select.ToList();
            var itemstb = select.ToDataTable();
        }
        public void CurdAllField()
        {
            var item = new TableAllType {
            };

            item.Id = (int)insert.AppendData(item).ExecuteIdentity();

            var newitem = select.Where(a => a.Id == item.Id).ToOne();

            var item2 = new TableAllType
            {
                testFieldBool                   = true,
                testFieldBoolNullable           = true,
                testFieldByte                   = byte.MaxValue,
                testFieldByteNullable           = byte.MinValue,
                testFieldBytes                  = Encoding.UTF8.GetBytes("我是中国人"),
                testFieldDateTime               = DateTime.Now,
                testFieldDateTimeNullable       = DateTime.Now.AddHours(1),
                testFieldDateTimeNullableOffset = new DateTimeOffset(DateTime.Now.AddHours(1), TimeSpan.FromHours(8)),
                testFieldDateTimeOffset         = new DateTimeOffset(DateTime.Now, TimeSpan.FromHours(8)),
                testFieldDecimal                = 998.99M,
                testFieldDecimalNullable        = 999.12M,
                testFieldDouble                 = 99.199,
                testFieldDoubleNullable         = 99.211,
                testFieldEnum1                  = TableAllTypeEnumType1.e2,
                testFieldEnum1Nullable          = TableAllTypeEnumType1.e3,
                testFieldEnum2                  = TableAllTypeEnumType2.f3,
                testFieldEnum2Nullable          = TableAllTypeEnumType2.f2,
                testFieldFloat                  = 0.99F,
                testFieldFloatNullable          = 0.11F,
                testFieldGuid                   = Guid.NewGuid(),
                testFieldGuidNullable           = Guid.NewGuid(),
                testFieldInt              = int.MaxValue,
                testFieldIntNullable      = int.MinValue,
                testFieldLong             = long.MaxValue,
                testFieldSByte            = sbyte.MaxValue,
                testFieldSByteNullable    = sbyte.MinValue,
                testFieldShort            = short.MaxValue,
                testFieldShortNullable    = short.MinValue,
                testFieldString           = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
                testFieldChar             = 'X',
                testFieldTimeSpan         = TimeSpan.FromSeconds(999),
                testFieldTimeSpanNullable = TimeSpan.FromSeconds(30),
                testFieldUInt             = uint.MaxValue,
                testFieldUIntNullable     = uint.MinValue,
                testFieldULong            = ulong.MaxValue,
                testFieldULongNullable    = ulong.MinValue,
                testFieldUShort           = ushort.MaxValue,
                testFieldUShortNullable   = ushort.MinValue,
                testFielLongNullable      = long.MinValue
            };

            var sqlPar  = insert.AppendData(item2).ToSql();
            var sqlText = insert.AppendData(item2).NoneParameter().ToSql();
            var item3NP = insert.AppendData(item2).NoneParameter().ExecuteInserted();

            var sqlTestUpdate = g.sqlserver.Update <TableAllType>().SetSource(item3NP).NoneParameter().ToSql();

            var item3    = insert.AppendData(item2).ExecuteInserted();
            var newitem2 = select.Where(a => a.Id == item3[0].Id).ToOne();

            Assert.Equal(item2.testFieldString, newitem2.testFieldString);
            Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);

            item3    = insert.NoneParameter().AppendData(item2).ExecuteInserted();
            newitem2 = select.Where(a => a.Id == item3[0].Id).ToOne();
            Assert.Equal(item2.testFieldString, newitem2.testFieldString);
            Assert.Equal(item2.testFieldChar, newitem2.testFieldChar);

            var items   = select.ToList();
            var itemstb = select.ToDataTable();
        }