1.MapTo
解析:MapTo扩展方法通过复制具有相同命名的所有属性将Book对象转换为BookDto对象:

public async Task<BookDto> GetAsync(Guid id)
{var book = await _bookRepository.GetAsync(id);return book.MapTo<BookDto>();
}

MapTo的另一种替代方法是使用IObjectMapper服务:

public async Task<BookDto> GetAsync(Guid id)
{var book = await _bookRepository.GetAsync(id);return ObjectMapper.Map<Book, BookDto>(book);
}

2.ICrudAppService接口
解析:CrudAppService实现了ICrudAppService接口中声明的所有方法,然后可以添加自己的自定义方法或覆盖和自定义实现。

public interface ICrudAppService<TEntityDto, in TKey, in TGetListInput, in TCreateInput, in TUpdateInput>: IApplicationService where TEntityDto : IEntityDto<TKey>
{Task<TEntityDto> GetAsync(TKey id);Task<PagedResultDto<TEntityDto>> GetListAsync(TGetListInput input);Task<TEntityDto> CreateAsync(TCreateInput input);Task<TEntityDto> UpdateAsync(TKey id, TUpdateInput input);Task DeleteAsync(TKey id);
}

3.AbstractKeyCrudAppService
解析:
[1]CrudAppService要求实体拥有一个Id属性做为主键,如果使用的是复合主键,那么无法使用它
[2]AbstractKeyCrudAppService实现了相同的ICrudAppService接口,但它没有假设主键
[3]使用AbstractKeyCrudAppService时需要自己实现DeleteByIdAsync和GetEntityByIdAsync方法

4.应用服务生命周期
解析:应用服务的生命周期是transient的,它们会自动注册到依赖注入系统。

5.ABP仓储
解析:
[1]在领域层和数据映射层之间进行中介,使用类似集合的接口来操作领域对象
[2]可以在服务中注入IRepository<TEntity,TKey>使用标准的CRUD操作

6.通用仓储
解析:通用仓储提供了一些开箱即用的标准CRUD功能:
[1]提供Insert方法用于保存新实体
[2]提供Update和Delete方法通过实体或实体id更新或删除实体
[3]提供Delete方法使用条件表达式过滤删除多个实体
[4]实现了IQueryable<TEntity>,所以可以使用LINQ和扩展方法FirstOrDefault、Where、OrderBy、ToList等
[5]所有方法都具有sync[同步]和async[异步]版本

7.基础仓储
解析:IRepository<TEntity,TKey>接口扩展了标准IQueryable<TEntity>,可以使用标准LINQ方法自由查询。但某些ORM提供程序或数据库系统可能不支持IQueryable接口。

8.只读仓储
解析:对于想要使用只读仓储的开发者,提供了IReadOnlyRepository<TEntity,TKey>与IReadOnlyBasicRepository<Tentity,TKey>接口。

9.AggregateRoot类
解析:
[1]AggregateRoot类实现了IHasExtraProperties和IHasConcurrencyStamp接口,这为派生类带来了两个属性
[2]IHasExtraProperties使实体可扩展
[3]IHasConcurrencyStamp添加了由ABP框架管理的ConcurrencyStamp属性实现乐观并发
说明:如果不需要派生类这个属性,那么聚合根可以继承BasicAggregateRoot<TKey>[或BasicAggregateRoot]。

10.IFullAuditedObject
解析:IFullAuditedObject继承IAuditedObject和IDeletionAuditedObject,所以它定义了以下属性:

CreationTime
CreatorId
LastModificationTime
LastModifierId
IsDeleted
DeletionTime
DeleterId

11.ABP种子数据
解析:
[1]IDataSeeder:IDataSeeder是用于生成初始数据的主要服务
[2]IDataSeedContributor:将数据种子化到数据库需要实现IDataSeedContributor接口

12.JwtBearerDefaults.AuthenticationScheme
解析:在JwtBearerAuthenticationOptions中,对于AuthenticationScheme属性的默认值。

context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>{options.Authority = configuration["AuthServer:Authority"];options.RequireHttpsMetadata = false;options.Audience = "BaseService";});

13.配置Cors跨域
解析:

context.Services.AddCors(options =>
{options.AddPolicy(DefaultCorsPolicyName, builder =>{builder.WithOrigins(configuration["App:CorsOrigins"].Split(",", StringSplitOptions.RemoveEmptyEntries).Select(o => o.RemovePostFix("/")).ToArray()).WithAbpExposedHeaders().SetIsOriginAllowedToAllowWildcardSubdomains().AllowAnyHeader().AllowAnyMethod().AllowCredentials();});
});

14.public interface IApiResourceRepository
解析:

IBasicRepository<ApiResource, Guid>
IBasicRepository<ApiResource>
IReadOnlyBasicRepository<ApiResource>
IRepository
IReadOnlyBasicRepository<ApiResource, Guid>

15.public interface IApiScopeRepository
解析:

IBasicRepository<ApiScope, Guid>
IBasicRepository<ApiScope>
IReadOnlyBasicRepository<ApiScope>
IRepository
IReadOnlyBasicRepository<ApiScope, Guid>

16.public interface IClientRepository
解析:

IBasicRepository<Client, Guid>
IBasicRepository<Client>
IReadOnlyBasicRepository<Client>
IRepository
IReadOnlyBasicRepository<Client, Guid>

17.public interface IIdentityResourceDataSeeder
解析:Task CreateStandardResourcesAsync();

18.public interface IGuidGenerator
解析:Guid Create();

19.public ApiResource(Guid id, string name, string displayName = null, string description = null)
解析:

Check.NotNull<string>(name, nameof (name));
this.Id = id;
this.Name = name;
this.DisplayName = displayName;
this.Description = description;
this.Enabled = true;
this.Secrets = new List<ApiResourceSecret>();
this.Scopes = new List<ApiResourceScope>();
this.UserClaims = new List<ApiResourceClaim>();
this.Properties = new List<ApiResourceProperty>();
this.Scopes.Add(new ApiResourceScope(id, name));

20.public Client(Guid id, string clientId)
解析:

Check.NotNull<string>(clientId, nameof (clientId));
this.ClientId = clientId;
this.ProtocolType = "oidc";
this.RequireClientSecret = true;
this.RequireConsent = false;
this.AllowRememberConsent = true;
this.RequirePkce = true;
this.FrontChannelLogoutSessionRequired = true;
this.BackChannelLogoutSessionRequired = true;
this.IdentityTokenLifetime = 300;
this.AccessTokenLifetime = 3600;
this.AuthorizationCodeLifetime = 300;
this.AbsoluteRefreshTokenLifetime = 2592000;
this.SlidingRefreshTokenLifetime = 1296000;
this.RefreshTokenUsage = 1;
this.RefreshTokenExpiration = 1;
this.AccessTokenType = 0;
this.EnableLocalLogin = true;
this.ClientClaimsPrefix = "client_";
this.AllowedScopes = new List<ClientScope>();
this.ClientSecrets = new List<ClientSecret>();
this.AllowedGrantTypes = new List<ClientGrantType>();
this.AllowedCorsOrigins = new List<ClientCorsOrigin>();
this.RedirectUris = new List<ClientRedirectUri>();
this.PostLogoutRedirectUris = new List<ClientPostLogoutRedirectUri>();
this.IdentityProviderRestrictions = new List<ClientIdPRestriction>();
this.Claims = new List<ClientClaim>();
this.Properties = new List<ClientProperty>();

21.public ApiScope(Guid id, string name, string displayName = null, string description = null, bool required = false, bool emphasize = false, bool showInDiscoveryDocument = true, bool enabled = true)
解析:

Check.NotNull<string>(name, nameof (name));
this.Id = id;
this.Name = name;
this.DisplayName = displayName ?? name;
this.Description = description;
this.Required = required;
this.Emphasize = emphasize;
this.ShowInDiscoveryDocument = showInDiscoveryDocument;
this.Enabled = enabled;
this.UserClaims = new List<ApiScopeClaim>();
this.Properties = new List<ApiScopeProperty>();

22.public abstract class ApplicationService
解析:

IApplicationService
IRemoteService
IAvoidDuplicateCrossCuttingConcerns
IValidationEnabled
IUnitOfWorkEnabled
IAuditingEnabled
IGlobalFeatureCheckingEnabled
ITransientDependency

23.public class DatabaseFacade
解析:提供访问这个上下文的数据库相关信息和操作。

24.public interface IRouteValueProvider
解析:

string RouteKey { get; }
string RouteValue { get; }

25.public class PagedAndSortedResultRequestDto
解析:

PagedResultRequestDto
IPagedAndSortedResultRequest
IPagedResultRequest
ILimitedResultRequest
ISortedResultRequest

参考文献:
[1]ABP应用服务:https://docs.abp.io/zh-Hans/abp/4.4/Application-Services
[2]ABP仓储:https://docs.abp.io/zh-Hans/abp/4.4/Repositories
[3]ABP实体:https://docs.abp.io/zh-Hans/abp/4.4/Entities
[4]ABP种子数据:https://docs.abp.io/zh-Hans/abp/4.4/Data-Seeding

ABP VNext学习日记24相关推荐

  1. ABP VNext学习日记17

    1.public static Assembly GetExecutingAssembly() 解析:得到包含的代码正在执行的程序集. 2.public interface IHostedServic ...

  2. ABP VNext学习日记20

    1.AbpApiControllerActivator 解析:实现了IHttpControllerActivator接口,根据controller的类型生成指定的controller. 2.AbpDy ...

  3. ABP VNext学习日记15

    1.Polly服务容错模式 解析: [1]错误处理fault handling:重试.熔断.回退 [2]弹性应变resilience:超时.舱壁.缓存 2.Polly错误处理步骤 解析: [1]定义条 ...

  4. ABP VNext学习日记3

    1.ABP中的DTO 解析:在ABP的设计中,有两种不同类型的DTO,分别是用于新增.修改.删除的Input DTO,和用于查询的Output DTO. 2.Unit of Work 解析:工作单元与 ...

  5. ABP VNext学习日记21

    1.public class PagedResultDto<T> : ListResultDto<T>, IPagedResult<T> 解析: public lo ...

  6. ABP VNext学习日记18

    1.IAuthorizationService 解析:IAuthorizationService具有两个AuthorizeAsync方法重载:一个接受资源和策略名称,另一个接受资源并提供要评估的要求的 ...

  7. ABP VNext学习日记22

    1.PreConfigureServices和PostConfigureServices 解析:AbpModule类还定义了PreConfigureServices和PostConfigureServ ...

  8. ABP VNext学习日记1

    1.安装和更新ABP CLI 解析: dotnet tool install -g Volo.Abp.Cli dotnet tool update -g Volo.Abp.Cli 2.模块拆分原则 解 ...

  9. ABP VNext学习日记14

    1.Abp.AbpBootstrapper 解析:这是一个主类,它负责开始全部的ABP系统. 2.Abp.Dependency.IocManager 解析:这个类用于直接执行依赖注入任务. 3.voi ...

最新文章

  1. MIT 更新最大自然灾害图像数据集,囊括 19 种灾害事件
  2. JQuery学习笔记 [Ajax] (6-2)
  3. mysql _bin编码_mysql中utf8_bin、utf8_general_ci、utf8_general_cs编码区别
  4. 让li不显示超出内容,显示... (编程方法和CSS方法)
  5. VideoPlayer
  6. 电气线材选型入门(rv、rvv、rvvp、avvr、蓝白排线等)
  7. shiyou的数值分析作业
  8. Sql Server (Stuff)(随手笔记)
  9. win10如何给c盘增加分区
  10. PS制作压印效果的logo等
  11. 热拉登陆找不到服务器,在线服务器服务器路径.ppt
  12. Android 收银机Wifi 连接厨房厨单打印机
  13. 计算机组成原理—储存器的层次结构
  14. 均方误差损失函数(MSE,mean squared error)
  15. 四种常见的Git工作流
  16. 5G NR Rel16 两步接入/2-step RACH
  17. 走近富兰克林--《富兰克林自传》
  18. 斯坦福大学CS106A公开课笔记--启示环境配置
  19. 温绍锦:初心不改的阿里初代开源人 | 码云封面人物第 18 期
  20. 记录生产问题之Excel模板文件下载

热门文章

  1. 20220603怎么查询公网IP
  2. 5.PCIe协议分析3-PCIe TLP包详解1
  3. 2021年11月14日
  4. js基础笔记(持续更新)
  5. Ubuntu下无法使用add-apt-repository命令 白豆腐徐长卿
  6. linux smit工具,Linux安全基础 SMIT入门
  7. 目前应用最多的四种制图软件!
  8. c语言普及组复赛题目大全,NOIP 2016普及组复赛C/C++详细题解报告
  9. 基于Lattice XO2-4000HC FPGA核心板及电子森林综合训练底板的ADC数字电压表及OLED显示设计(Verilog)
  10. 解决IDEA创建maven项目时没有src目录