mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
【测试】三大数据库,添加所有类型数据null/非空,后查询正常
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Npgsql;
|
||||
using Npgsql.LegacyPostgis;
|
||||
using NpgsqlTypes;
|
||||
using System;
|
||||
@ -9,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace FreeSql.Tests.PostgreSQL {
|
||||
@ -49,7 +51,236 @@ namespace FreeSql.Tests.PostgreSQL {
|
||||
g.pgsql.Select<TableAllType>();
|
||||
}
|
||||
|
||||
|
||||
IInsert<TableAllType> insert => g.pgsql.Insert<TableAllType>();
|
||||
ISelect<TableAllType> select => g.pgsql.Select<TableAllType>();
|
||||
|
||||
[Fact]
|
||||
public void CurdAllField() {
|
||||
NpgsqlConnection.GlobalTypeMapper.UseLegacyPostgis();
|
||||
|
||||
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("<22><><EFBFBD><EFBFBD>")),
|
||||
testFieldBitArrayArray = new[] { new BitArray(Encoding.UTF8.GetBytes("<22>й<EFBFBD>")), new BitArray(Encoding.UTF8.GetBytes("<22><><EFBFBD><EFBFBD>")) },
|
||||
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("<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>"),
|
||||
testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>"), Encoding.UTF8.GetBytes("<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>") },
|
||||
testFieldCidr = (IPAddress.Parse("10.0.0.0"), 8),
|
||||
testFieldCidrArray = new[] { (IPAddress.Parse("10.0.0.0"), 8), (IPAddress.Parse("192.168.0.0"), 16) },
|
||||
testFieldCidrArrayNullable = new (IPAddress, int)?[] { (IPAddress.Parse("10.0.0.0"), 8), null, (IPAddress.Parse("192.168.0.0"), 16) },
|
||||
testFieldCidrNullable = (IPAddress.Parse("192.168.0.0"), 16),
|
||||
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(),
|
||||
testFieldHStore = new Dictionary<string, string> { { "111", "value111" }, { "222", "value222" }, { "333", "value333" } },
|
||||
testFieldHStoreArray = new[] { new Dictionary<string, string> { { "111", "value111" }, { "222", "value222" }, { "333", "value333" } }, new Dictionary<string, string> { { "444", "value444" }, { "555", "value555" }, { "666", "value666" } } },
|
||||
testFieldInet = IPAddress.Parse("192.168.1.1"),
|
||||
testFieldInetArray = new[] { IPAddress.Parse("192.168.1.1"), IPAddress.Parse("192.168.1.2"), IPAddress.Parse("192.168.1.3") },
|
||||
testFieldInt = int.MaxValue,
|
||||
testFieldInt4range = new NpgsqlRange<int>(10, 20),
|
||||
testFieldInt4rangeArray = new[] { new NpgsqlRange<int>(10, 20), new NpgsqlRange<int>(50, 100), new NpgsqlRange<int>(200, 300) },
|
||||
testFieldInt4rangeArrayNullable = new NpgsqlRange<int>?[] { new NpgsqlRange<int>(10, 20), new NpgsqlRange<int>(50, 100), null, new NpgsqlRange<int>(200, 300) },
|
||||
testFieldInt4rangeNullable = new NpgsqlRange<int>(100, 200),
|
||||
testFieldInt8range = new NpgsqlRange<long>(100, 200),
|
||||
testFieldInt8rangeArray = new[] { new NpgsqlRange<long>(100, 200), new NpgsqlRange<long>(500, 1000), new NpgsqlRange<long>(2000, 3000) },
|
||||
testFieldInt8rangeArrayNullable = new NpgsqlRange<long>?[] { new NpgsqlRange<long>(100, 200), new NpgsqlRange<long>(500, 1000), null, new NpgsqlRange<long>(2000, 3000) },
|
||||
testFieldInt8rangeNullable = new NpgsqlRange<long>(1000, 2000),
|
||||
testFieldIntArray = new[] { 1, 2, 3, 4, 5 },
|
||||
testFieldIntArrayNullable = new int?[] { 1, 2, 3, null, 4, 5 },
|
||||
testFieldIntNullable = int.MinValue,
|
||||
testFieldJArray = JArray.Parse("[1,2,3,4,5]"),
|
||||
testFieldJArrayArray = new[] { JArray.Parse("[1,2,3,4,5]"), JArray.Parse("[10,20,30,40,50]") },
|
||||
testFieldJObject = JObject.Parse("{ \"a\":1, \"b\":2, \"c\":3 }"),
|
||||
testFieldJObjectArray = new[] { JObject.Parse("{ \"a\":1, \"b\":2, \"c\":3 }"), JObject.Parse("{ \"a\":10, \"b\":20, \"c\":30 }") },
|
||||
testFieldJToken = JToken.Parse("{ \"a\":1, \"b\":2, \"c\":3, \"d\":[1,2,3,4,5] }"),
|
||||
testFieldJTokenArray = new[] { JToken.Parse("{ \"a\":1, \"b\":2, \"c\":3, \"d\":[1,2,3,4,5] }"), JToken.Parse("{ \"a\":10, \"b\":20, \"c\":30, \"d\":[10,20,30,40,50] }") },
|
||||
testFieldLong = long.MaxValue,
|
||||
testFieldLongArray = new long[] { 10, 20, 30, 40, 50 },
|
||||
testFieldMacaddr = PhysicalAddress.Parse("A1-A2-CD-DD-FF-02"),
|
||||
testFieldMacaddrArray = new[] { PhysicalAddress.Parse("A1-A2-CD-DD-FF-02"), PhysicalAddress.Parse("A2-22-22-22-22-02") },
|
||||
testFieldNpgsqlBox = new NpgsqlBox(10, 100, 100, 10),
|
||||
testFieldNpgsqlBoxArray = new[] { new NpgsqlBox(10, 100, 100, 10), new NpgsqlBox(200, 2000, 2000, 200) },
|
||||
testFieldNpgsqlBoxArrayNullable = new NpgsqlBox?[] { new NpgsqlBox(10, 100, 100, 10), null, new NpgsqlBox(200, 2000, 2000, 200) },
|
||||
testFieldNpgsqlBoxNullable = new NpgsqlBox(200, 2000, 2000, 200),
|
||||
testFieldNpgsqlCircle = new NpgsqlCircle(50, 50, 100),
|
||||
testFieldNpgsqlCircleArray = new[] { new NpgsqlCircle(50, 50, 100), new NpgsqlCircle(80, 80, 100) },
|
||||
testFieldNpgsqlCircleArrayNullable = new NpgsqlCircle?[] { new NpgsqlCircle(50, 50, 100), null, new NpgsqlCircle(80, 80, 100) },
|
||||
testFieldNpgsqlCircleNullable = new NpgsqlCircle(80, 80, 100),
|
||||
testFieldNpgsqlLine = new NpgsqlLine(30, 30, 30),
|
||||
testFieldNpgsqlLineArray = new[] { new NpgsqlLine(30, 30, 30), new NpgsqlLine(35, 35, 35) },
|
||||
testFieldNpgsqlLineArrayNullable = new NpgsqlLine?[] { new NpgsqlLine(30, 30, 30), null, new NpgsqlLine(35, 35, 35) },
|
||||
testFieldNpgsqlLineNullable = new NpgsqlLine(60, 60, 60),
|
||||
testFieldNpgsqlLSeg = new NpgsqlLSeg(80, 10, 800, 20),
|
||||
testFieldNpgsqlLSegArray = new[] { new NpgsqlLSeg(80, 10, 800, 20), new NpgsqlLSeg(180, 20, 260, 50) },
|
||||
testFieldNpgsqlLSegArrayNullable = new NpgsqlLSeg?[] { new NpgsqlLSeg(80, 10, 800, 20), null, new NpgsqlLSeg(180, 20, 260, 50) },
|
||||
testFieldNpgsqlLSegNullable = new NpgsqlLSeg(180, 20, 260, 50),
|
||||
testFieldNpgsqlPath = new NpgsqlPath(new NpgsqlPoint(10, 10), new NpgsqlPoint(15, 10), new NpgsqlPoint(17, 10), new NpgsqlPoint(19, 10)),
|
||||
testFieldNpgsqlPathArray = new[] { new NpgsqlPath(new NpgsqlPoint(10, 10), new NpgsqlPoint(15, 10), new NpgsqlPoint(17, 10), new NpgsqlPoint(19, 10)), new NpgsqlPath(new NpgsqlPoint(210, 10), new NpgsqlPoint(215, 10), new NpgsqlPoint(217, 10), new NpgsqlPoint(219, 10)) },
|
||||
testFieldNpgsqlPathArrayNullable = new NpgsqlPath?[] { new NpgsqlPath(new NpgsqlPoint(10, 10), new NpgsqlPoint(15, 10), new NpgsqlPoint(17, 10), new NpgsqlPoint(19, 10)), null, new NpgsqlPath(new NpgsqlPoint(210, 10), new NpgsqlPoint(215, 10), new NpgsqlPoint(217, 10), new NpgsqlPoint(219, 10)) },
|
||||
testFieldNpgsqlPathNullable = new NpgsqlPath(new NpgsqlPoint(210, 10), new NpgsqlPoint(215, 10), new NpgsqlPoint(217, 10), new NpgsqlPoint(219, 10)),
|
||||
testFieldNpgsqlPoint = new NpgsqlPoint(666, 666),
|
||||
testFieldNpgsqlPointArray = new[] { new NpgsqlPoint(666, 666), new NpgsqlPoint(888, 888) },
|
||||
testFieldNpgsqlPointArrayNullable = new NpgsqlPoint?[] { new NpgsqlPoint(666, 666), null, new NpgsqlPoint(888, 888) },
|
||||
testFieldNpgsqlPointNullable = new NpgsqlPoint(888, 888),
|
||||
testFieldNpgsqlPolygon = new NpgsqlPolygon(new NpgsqlPoint(36, 30), new NpgsqlPoint(36, 50), new NpgsqlPoint(38, 80), new NpgsqlPoint(36, 30)),
|
||||
testFieldNpgsqlPolygonArray = new[] { new NpgsqlPolygon(new NpgsqlPoint(36, 30), new NpgsqlPoint(36, 50), new NpgsqlPoint(38, 80), new NpgsqlPoint(36, 30)), new NpgsqlPolygon(new NpgsqlPoint(136, 130), new NpgsqlPoint(136, 150), new NpgsqlPoint(138, 180), new NpgsqlPoint(136, 130)) },
|
||||
testFieldNpgsqlPolygonArrayNullable = new NpgsqlPolygon?[] { new NpgsqlPolygon(new NpgsqlPoint(36, 30), new NpgsqlPoint(36, 50), new NpgsqlPoint(38, 80), new NpgsqlPoint(36, 30)), null, new NpgsqlPolygon(new NpgsqlPoint(136, 130), new NpgsqlPoint(136, 150), new NpgsqlPoint(138, 180), new NpgsqlPoint(136, 130)) },
|
||||
testFieldNpgsqlPolygonNullable = new NpgsqlPolygon(new NpgsqlPoint(136, 130), new NpgsqlPoint(136, 150), new NpgsqlPoint(138, 180), new NpgsqlPoint(136, 130)),
|
||||
testFieldNumrange = new NpgsqlRange<decimal>(888.88M, 999.99M),
|
||||
testFieldNumrangeArray = new[] { new NpgsqlRange<decimal>(888.88M, 999.99M), new NpgsqlRange<decimal>(18888.88M, 19998.99M) },
|
||||
testFieldNumrangeArrayNullable = new NpgsqlRange<decimal>?[] { new NpgsqlRange<decimal>(888.88M, 999.99M), null, new NpgsqlRange<decimal>(18888.88M, 19998.99M) },
|
||||
testFieldNumrangeNullable = new NpgsqlRange<decimal>(18888.88M, 19998.99M),
|
||||
testFieldPostgisGeometry = new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
testFieldPostgisGeometryArray = new PostgisGeometry[] {
|
||||
new PostgisPoint(555,551),
|
||||
new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }) , new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }),
|
||||
new PostgisMultiPolygon(new []{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
})
|
||||
},
|
||||
testFieldPostgisGeometryCollection = new PostgisGeometryCollection(new PostgisGeometry[] {
|
||||
new PostgisPoint(555,551),
|
||||
new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }) , new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }),
|
||||
new PostgisMultiPolygon(new []{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
})
|
||||
}),
|
||||
testFieldPostgisGeometryCollectionArray = new[] {
|
||||
new PostgisGeometryCollection(new PostgisGeometry[] {
|
||||
new PostgisPoint(555,551),
|
||||
new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }) , new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }),
|
||||
new PostgisMultiPolygon(new []{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
})
|
||||
}),new PostgisGeometryCollection(new PostgisGeometry[] {
|
||||
new PostgisPoint(555,551),
|
||||
new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }) , new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }),
|
||||
new PostgisMultiPolygon(new []{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
})
|
||||
})
|
||||
},
|
||||
testFieldPostgisLineString = new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }),
|
||||
testFieldPostgisLineStringArray = new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }), new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 220) }) },
|
||||
testFieldPostgisMultiPoint = new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }),
|
||||
testFieldPostgisMultiPointArray = new[] { new PostgisMultiPoint(new[] { new Coordinate2D(20, 21), new Coordinate2D(210, 220) }), new PostgisMultiPoint(new[] { new Coordinate2D(120, 121), new Coordinate2D(1210, 1220) }) },
|
||||
testFieldPostgisPoint = new PostgisPoint(555, 551),
|
||||
testFieldPostgisPointArray = new[] { new PostgisPoint(555, 551), new PostgisPoint(53355, 3551) },
|
||||
testFieldPostgisPolygon = new PostgisPolygon(new[] { new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
testFieldPostgisPolygonArray = new[]{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
},
|
||||
testFieldPostgisPostgisMultiLineString = new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }), new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
testFieldPostgisPostgisMultiLineStringArray = new[] {
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110) }) , new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 210) }) }),
|
||||
new PostgisMultiLineString(new[] { new PostgisLineString(new[] { new Coordinate2D(20, 21), new Coordinate2D(200, 220) }) , new PostgisLineString(new[] { new Coordinate2D(820, 821), new Coordinate2D(800, 810) }) })
|
||||
},
|
||||
testFieldPostgisPostgisMultiPolygon = new PostgisMultiPolygon(new[]{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
}),
|
||||
testFieldPostgisPostgisMultiPolygonArray = new[] {
|
||||
new PostgisMultiPolygon(new[]{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
}),
|
||||
new PostgisMultiPolygon(new[]{
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(10, 11), new Coordinate2D(100, 110), new Coordinate2D(300, 310), new Coordinate2D(10, 11) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } }),
|
||||
new PostgisPolygon(new []{ new[] { new Coordinate2D(50, 51), new Coordinate2D(500, 510), new Coordinate2D(800, 810), new Coordinate2D(50, 51) }, new[] { new Coordinate2D(20, 11), new Coordinate2D(200, 110), new Coordinate2D(100, 310), new Coordinate2D(20, 11) } })
|
||||
})
|
||||
},
|
||||
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 = "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>String",
|
||||
testFieldStringArray = new[] { "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>String1", "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>String2", null, "<22><><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>String3" },
|
||||
testFieldTimeSpan = TimeSpan.FromDays(1),
|
||||
testFieldTimeSpanArray = new[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60) },
|
||||
testFieldTimeSpanArrayNullable = new TimeSpan?[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), null, TimeSpan.FromSeconds(60) },
|
||||
testFieldTimeSpanNullable = TimeSpan.FromSeconds(90),
|
||||
testFieldTsrange = new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(1)),
|
||||
testFieldTsrangeArray = new[] { new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(1)), new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(2)) },
|
||||
testFieldTsrangeArrayNullable = new NpgsqlRange<DateTime>?[] { new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(1)), null, new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(2)) },
|
||||
testFieldTsrangeNullable = new NpgsqlRange<DateTime>(DateTime.Now, DateTime.Now.AddMonths(2)),
|
||||
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
|
||||
};
|
||||
item2.Id = (int)insert.AppendData(item2).ExecuteIdentity();
|
||||
var newitem2 = select.Where(a => a.Id == item2.Id).ToOne();
|
||||
|
||||
var items = select.ToList();
|
||||
}
|
||||
|
||||
[Table(Name = "tb_alltype")]
|
||||
class TableAllType {
|
||||
[Column(IsIdentity = true, IsPrimary = true)]
|
||||
|
Reference in New Issue
Block a user