Created
July 17, 2023 01:28
-
-
Save maliming/7ab15800f66bd12b8f67564e0624ce30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net7.0</TargetFramework> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<Nullable>enable</Nullable> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="7.3.0" /> | |
<PackageReference Include="Volo.Abp.Json.SystemTextJson" Version="7.3.0" /> | |
</ItemGroup> | |
</Project> | |
using System.Diagnostics; | |
using System.Text.Json; | |
using Microsoft.Extensions.DependencyInjection; | |
using Volo.Abp; | |
using Volo.Abp.Application.Dtos; | |
using Volo.Abp.Json.SystemTextJson; | |
using Volo.Abp.Json.SystemTextJson.JsonConverters; | |
using Volo.Abp.Modularity; | |
var json = await File.ReadAllTextAsync("response.json"); | |
var stopWatch = new Stopwatch(); | |
// stopWatch.Start(); | |
// var peoplesDto = JsonSerializer.Deserialize<ApiResponse<IEnumerable<PeopleDto>>>(json, new JsonSerializerOptions(JsonSerializerDefaults.Web)); | |
// stopWatch.Stop(); | |
// Console.WriteLine($"Deserialize: {stopWatch.ElapsedMilliseconds} ms"); | |
// | |
// return 0; | |
using (var application = AbpApplicationFactory.Create<AppModule>()) | |
{ | |
application.Services.Configure<AbpSystemTextJsonSerializerOptions>(options => | |
{ | |
//options.JsonSerializerOptions.Converters.Clear(); | |
}); | |
application.Services.Configure<AbpSystemTextJsonSerializerModifiersOptions>(options => | |
{ | |
//options.Modifiers.Clear(); | |
}); | |
await application.InitializeAsync(); | |
var abpJsonSerializer = application.ServiceProvider.GetRequiredService<AbpSystemTextJsonSerializer>(); | |
stopWatch.Restart(); | |
var peoplesDto2 = abpJsonSerializer.Deserialize<ApiResponse<IEnumerable<PeopleDto>>>(json); | |
stopWatch.Stop(); | |
Console.WriteLine($"Deserialize: {stopWatch.ElapsedMilliseconds} ms"); | |
} | |
return 0; | |
[DependsOn(typeof(AbpJsonSystemTextJsonModule))] | |
public class AppModule : AbpModule | |
{ | |
} | |
public class AdministrativePositionLevelDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class ApiResponse<TResult> | |
{ | |
public ApiResponse(TResult result) | |
{ | |
Result = result; | |
} | |
public bool __chao { get; } = true; | |
public TResult Result { get; set; } | |
public bool Success { get; } = true; | |
} | |
public class AreaDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class GenderDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class OrganizationCategoryDto : EntityDto<Guid> | |
{ | |
public virtual string Name { get; set; } | |
} | |
public class OrganizationDto : EntityDto<Guid> | |
{ | |
public virtual bool? Administration { get; set; } | |
public virtual AreaDto Area { get; set; } | |
public virtual Guid? AreaId { get; set; } | |
public virtual IEnumerable<OrganizationDto> Children { get; protected set; } | |
public virtual string Code { get; set; } | |
public virtual bool? College { get; set; } | |
public virtual bool? Department { get; set; } | |
public virtual string Designation { get; set; } | |
public virtual long? EnableEndDate { get; set; } | |
public virtual long? EnableStartDate { get; set; } | |
public virtual string EnglishName { get; set; } | |
public virtual string Name { get; set; } | |
public virtual float Order { get; set; } | |
public virtual OrganizationCategoryDto OrganizationCategory { get; set; } | |
public virtual Guid? OrganizationCategoryId { get; set; } | |
public virtual Guid? ParentId { get; set; } | |
public virtual string ShortName { get; set; } | |
public virtual bool Virtual { get; set; } | |
} | |
public class PositionCategoryDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class ProfessionalPositionDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
public virtual ProfessionalPositionLevelDto ProfessionalPositionLevel { get; set; } | |
public virtual Guid? ProfessionalPositionLevelId { get; set; } | |
} | |
public class ProfessionalPositionLevelDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class RoleDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class PeopleDto : EntityDto<Guid> | |
{ | |
public virtual OrganizationDto AdministrativeOrganization { get; set; } | |
public virtual Guid AdministrativeOrganizationId { get; set; } | |
public virtual AdministrativePositionLevelDto AdministrativePositionLevel { get; set; } | |
public virtual Guid? AdministrativePositionLevelId { get; set; } | |
public virtual string AdministrativePositionTitle { get; set; } | |
public virtual AreaDto Area { get; set; } | |
public virtual Guid? AreaId { get; set; } | |
public virtual OrganizationDto BusinessOrganization { get; set; } | |
public virtual Guid? BusinessOrganizationId { get; set; } | |
public virtual string CardId { get; set; } | |
public virtual OrganizationDto Department { get; set; } | |
public virtual Guid? DepartmentId { get; set; } | |
public virtual string Email { get; set; } | |
public virtual long? ExpirationDate { get; set; } | |
public virtual string FullName { get; set; } | |
public virtual GenderDto Gender { get; set; } | |
public virtual Guid? GenderId { get; set; } | |
public virtual string Phone { get; set; } | |
public virtual string Phone2 { get; set; } | |
public virtual string PhysicalCardId { get; set; } | |
public virtual PositionCategoryDto PositionCategory { get; set; } | |
public virtual Guid? PositionCategoryId { get; set; } | |
public virtual ProfessionalPositionDto ProfessionalPosition { get; set; } | |
public virtual Guid? ProfessionalPositionId { get; set; } | |
public virtual IEnumerable<RoleDto> Roles { get; set; } | |
public virtual string TeacherId { get; set; } | |
public virtual UserStatusDto UserStatus { get; set; } | |
public virtual Guid? UserStatusId { get; set; } | |
public virtual UserTagDto UserTag { get; set; } | |
public virtual Guid? UserTagId { get; set; } | |
public virtual UserTypeDto UserType { get; set; } | |
public virtual Guid? UserTypeId { get; set; } | |
} | |
public class UserStatusDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class UserTagDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} | |
public class UserTypeDto : EntityDto<Guid> | |
{ | |
public virtual string Code { get; set; } | |
public virtual string Name { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment