Skip to content

Commit 93c6835

Browse files
authored
Merge pull request #36 from AmpScm/feat/jsonnode
Generalize and test JsonNode/Object/Array support over the different providers
2 parents 297fa71 + 7f2894a commit 93c6835

108 files changed

Lines changed: 1464 additions & 655 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-pr.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.119" />
4040
<PackageVersion Include="System.Dynamic.Runtime" Version="4.3.0" />
4141
<PackageVersion Include="System.Memory" Version="4.6.3" />
42+
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
4243
</ItemGroup>
4344
<ItemGroup>
4445
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />

src/RepoDb.Core.IntegrationTests/PropertyHandlerImplicitTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ private class EntityModelForClass
223223

224224
public short ColumnFloatNotNull { get; set; } = 0;
225225

226-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
226+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
227227

228-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
228+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
229229
}
230230

231231
private class ImmutableEntityModelForClass
@@ -249,9 +249,9 @@ public ImmutableEntityModelForClass(long id,
249249

250250
public short ColumnFloatNotNull { get; set; } = 0;
251251

252-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
252+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
253253

254-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
254+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
255255
}
256256

257257
private class EntityModelForIntToStringType
@@ -268,9 +268,9 @@ private class EntityModelForIntToStringType
268268

269269
public short ColumnFloatNotNull { get; set; } = 0;
270270

271-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
271+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
272272

273-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
273+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
274274
}
275275

276276
private class EntityModelForNumberPropertiesToLongType
@@ -289,9 +289,9 @@ private class EntityModelForNumberPropertiesToLongType
289289

290290
public short ColumnFloatNotNull { get; set; } = 0;
291291

292-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
292+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
293293

294-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
294+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
295295
}
296296

297297
private class EntityModelForDateTimeKind

src/RepoDb.Core.IntegrationTests/PropertyHandlerTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ private class EntityModelForClass
214214

215215
public short ColumnFloatNotNull { get; set; } = 0;
216216

217-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
217+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
218218

219-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
219+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
220220
}
221221

222222
[Map("[dbo].[PropertyHandler]")]
@@ -242,9 +242,9 @@ public ImmutableEntityModelForClass(long id,
242242

243243
public short ColumnFloatNotNull { get; set; } = 0;
244244

245-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
245+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
246246

247-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
247+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
248248
}
249249

250250
[Map("[dbo].[PropertyHandler]")]
@@ -264,9 +264,9 @@ private class EntityModelForIntToStringType
264264

265265
public short ColumnFloatNotNull { get; set; } = 0;
266266

267-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
267+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
268268

269-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
269+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
270270
}
271271

272272
[Map("[dbo].[PropertyHandler]")]
@@ -288,9 +288,9 @@ private class EntityModelForNumberPropertiesToLongType
288288

289289
public short ColumnFloatNotNull { get; set; } = 0;
290290

291-
public DateTime ColumnDateTimeNotNull { get; set; } = System.DateTime.UtcNow.Date;
291+
public DateTime ColumnDateTimeNotNull { get; set; } = DateTime.UtcNow.Date;
292292

293-
public DateTime ColumnDateTime2NotNull { get; set; } = System.DateTime.UtcNow;
293+
public DateTime ColumnDateTime2NotNull { get; set; } = DateTime.UtcNow;
294294
}
295295

296296
[Map("[dbo].[PropertyHandler]")]

src/RepoDb.Core.UnitTests/Extensions/QueryFields/LeftTrimQueryFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ public void TestLeftTrimQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("LTRIM([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
class EntityClass
64+
{
65+
public string StringValue { get; set; }
66+
}
67+
68+
[TestMethod]
69+
public void TestParseLeftTrimQueryField()
70+
{
71+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.TrimStart() == "b");
72+
73+
Assert.AreEqual("(LTRIM([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
74+
}
6275
}

src/RepoDb.Core.UnitTests/Extensions/QueryFields/LengthQueryFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ public void TestLengthQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("LENGTH([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
class EntityClass
64+
{
65+
public string StringValue { get; set; }
66+
}
67+
68+
[TestMethod]
69+
public void TestParseLengthQueryField()
70+
{
71+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.Length == 12);
72+
73+
Assert.AreEqual("(LENGTH([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
74+
}
6275
}

src/RepoDb.Core.UnitTests/Extensions/QueryFields/LowerQueryFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ public void TestLowerQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("LOWER([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
class EntityClass
64+
{
65+
public string StringValue { get; set; }
66+
}
67+
68+
[TestMethod]
69+
public void TestParseLowerQueryField()
70+
{
71+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.ToLower() == "b");
72+
73+
Assert.AreEqual("(LOWER([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
74+
}
6275
}

src/RepoDb.Core.UnitTests/Extensions/QueryFields/RightTrimQueryFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ public void TestRightTrimQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("RTRIM([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
class EntityClass
64+
{
65+
public string StringValue { get; set; }
66+
}
67+
68+
[TestMethod]
69+
public void TestParseRightTrimQueryField()
70+
{
71+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.TrimEnd() == "b");
72+
73+
Assert.AreEqual("(RTRIM([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
74+
}
6275
}

src/RepoDb.Core.UnitTests/Extensions/QueryFields/TrimQueryFieldTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,18 @@ public void TestTrimQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("TRIM([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
64+
class EntityClass
65+
{
66+
public string StringValue { get; set; }
67+
}
68+
69+
[TestMethod]
70+
public void TestParseTrimQueryField()
71+
{
72+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.Trim() == "b");
73+
74+
Assert.AreEqual("(TRIM([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
75+
}
6276
}

src/RepoDb.Core.UnitTests/Extensions/QueryFields/UpperQueryFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ public void TestUpperQueryFieldGetStringWithIndex()
5959
// Assert
6060
Assert.AreEqual("UPPER([FieldName]) = @FieldName_1", text);
6161
}
62+
63+
class EntityClass
64+
{
65+
public string StringValue { get; set; }
66+
}
67+
68+
[TestMethod]
69+
public void TestParseUpperQueryField()
70+
{
71+
var qg = QueryGroup.Parse<EntityClass>(x => x.StringValue.ToUpper() == "b");
72+
73+
Assert.AreEqual("(UPPER([StringValue]) = @StringValue)", qg.GetString(new CustomDbSetting()));
74+
}
6275
}

0 commit comments

Comments
 (0)