efcore 8 json 列测试完毕
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-11-08 13:41:07 +08:00
parent 760321f8fa
commit 1f33a9fa4e
8 changed files with 36343 additions and 6 deletions
@@ -2327,7 +2327,7 @@
<param name="_hostEnvironment"></param>
</member>
<!-- Badly formed XML comment ignored for member "T:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService" -->
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)" -->
<!-- Badly formed XML comment ignored for member "M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Infra.EFCore.TestLength})" -->
<member name="M:IRaCIS.Core.Application.Service.OAuthService.TestClientCredentialsAsync">
<summary>
测试客户端凭证代码
@@ -21,10 +21,54 @@ namespace IRaCIS.Core.Application.Service.MinimalApiService
/// </summary>
[ApiExplorerSettings(GroupName = "Institution")]
public class TestMinimalApiService(IUserInfo _userInfo) : ServiceBase
public class TestMinimalApiService(IUserInfo _userInfo, IRepository<TestLength> _testLengthRepository) : ServiceBase
{
public async Task<IResponseOutput> TestEfcoreJson()
{
var dateTime = DateTime.Parse("2024-11-08");
//await _testLengthRepository.AddAsync(new TestLength()
//{
// Name = "Testddd",
// TestJsonObjectLsit=new List<TestJsonObject>() { new TestJsonObject() { Name="name1",Description="des1"} , new TestJsonObject() { Name = "name1", Description = "des1" } }
//});
//await _testLengthRepository.SaveChangesAsync();
//对于json 对象 不能使用count any 操作,但是简单的类型可以的
var jobjectList = _testLengthRepository.AsQueryable().ToList();
var d1 = _testLengthRepository.Where(t => t.StringList.Any(t => t == "string1")).ToList();
var d2 = _testLengthRepository.Where(t => t.StringList.Contains("string1")).ToList();
//selectMany 报错 不支持
//var d20 = _testLengthRepository.Where(t => t.StringList.Contains("string1")).SelectMany(t => t.StringList).ToList();
var d3 = _testLengthRepository.Where(t => t.TestEnumList.Contains(TestEnum.Default)).ToList();
var d4 = _testLengthRepository.Where(t => t.TestEnumList.Any(t => t == TestEnum.Default)).ToList();
var d5 = _testLengthRepository.Where(t => t.DateTimeList.Contains(dateTime)).ToList();
var d6 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t == dateTime)).ToList();
var d7 = _testLengthRepository.Where(t=>t.DateTimeList.Any(t=>t.Year==2024)).ToList();
var d8 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Month == 11)).ToList();
var d90 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).Select(t => t.DateTimeList).ToList();
//selectMany 报错 不支持
//var d9 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).SelectMany(t=>t.DateTimeList).ToList();
//var d10 = _testLengthRepository.Where(t => t.DateTimeList.Any(t => t.Year == 2024)).SelectMany(t => t.DateTimeList).Where(t=>t>dateTime.AddSeconds(1)).ToList();
return ResponseOutput.Ok();
}
[TrialGlobalLimit("AddOrUpdateTrial", "BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
public Task<List<string>> GetProjectList1Async()
{
@@ -38,7 +82,7 @@ namespace IRaCIS.Core.Application.Service.MinimalApiService
}
[AllowAnonymous]
[TrialGlobalLimit( "BeforeOngoingCantOpt")]
[TrialGlobalLimit("BeforeOngoingCantOpt")]
public IResponseOutput GetTest()
{