public async Task <ApiResult <TestVO> > GetResultTest1(TestDTO dto) { //参数校验 if (!dto.IsValid(out Exception ex)) { throw ex; } var expression = dto.GetExpression(); var orders = dto.GetOrder(); //var count = await _testRepository.CountAsync(expression); //var updateResult1 = await _testRepository.SetAsync(() => new { user_id = "eeeee" }, oo => oo.UserId == "4444"); TestDO demoDO = new TestDO { UserId = dto?.UserId, UserName = this.CurrentUser?.UserName }; //var updateResult3 = await _testRepository.SetAsync(demoDO); TestVO demoVO = this.ObjectMapper.Map <TestVO>(demoDO); var result = ApiResultUtil.IsSuccess(demoVO); return(await Task.FromResult(result)); }
public void SerializeDeserializeNullableEnumUtf8() { var test = new TestDO { Value = null, AnotherValue = 1, Flags = null }; var serialized = JsonSerializer.Generic.Utf8.Serialize <TestDO, IncludeNullsOriginalCaseResolver <byte> >(test); Assert.Contains("null", Encoding.UTF8.GetString(serialized)); var deserialized = JsonSerializer.Generic.Utf8.Deserialize <TestDO, IncludeNullsOriginalCaseResolver <byte> >(serialized); Assert.NotNull(deserialized); Assert.Null(deserialized.Value); }
public void SerializeDeserializeNullableEnumUtf16() { var test = new TestDO { Value = null, AnotherValue = 1, Flags = FlagsEnum.Fourth | FlagsEnum.First }; var serialized = JsonSerializer.Generic.Utf16.Serialize <TestDO, IncludeNullsOriginalCaseResolver <char> >(test); Assert.Contains("null", serialized); var deserialized = JsonSerializer.Generic.Utf16.Deserialize <TestDO, IncludeNullsOriginalCaseResolver <char> >(serialized); Assert.NotNull(deserialized); Assert.Null(deserialized.Value); }
public void init() { _testDO = new TestDO(); }