-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a31d97
commit 5e927f2
Showing
18 changed files
with
1,527 additions
and
126 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
document.querySelectorAll(".zoom").forEach((item) => { | ||
item.addEventListener("click", function () { | ||
this.classList.toggle("image-zoom-large"); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* 图片放大start */ | ||
.shadow { | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
} | ||
|
||
.zoom { | ||
transition: transform ease-in-out 0.5s; | ||
cursor: zoom-in; | ||
} | ||
|
||
.image-zoom-large { | ||
transform: scale(1.9); | ||
cursor: zoom-out; | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
z-index: 100; | ||
position: relative; | ||
} | ||
/* 图片放大end https://shafish.cn/blog/mkdocs/#%E5%9B%9B%E9%83%A8%E7%BD%B2*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,27 @@ | ||
Title: Abp Vnext Pro | ||
Title: Abp vNext Pro | ||
|
||
# Abp Vnext Pro | ||
|
||
<img width="140" align="right" src="/img/logo.svg"> | ||
<img width="140" align="right" src="img/logo.svg"> | ||
[![AppVeyor](https://ci.appveyor.com/api/projects/status/v8gfh6pe2u2laqoa/branch/master?svg=true)](https://ci.appveyor.com/project/yuleyule66/cap/branch/master) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/WangJunZzz/abp-vnext-pro/blob/main/LICENSE) | ||
|
||
## 介绍 | ||
|
||
- 完全免费开源 | ||
- ABP vNext 的前身是 asp.net boilerplate(老版 abp),它不是一个简单的版本更新,而是完全基于.NET Core 的重写。 | ||
- ABP vNext 社区版的 UI 不使用于实际项目开发。为此,结合 Vben Admin 打造开箱即用的 ABP vNext Pro。 | ||
|
||
## 演示 | ||
|
||
- [演示地址](http://116.205.177.85/login) | ||
|
||
## 系统功能 | ||
|
||
- [x] 用户管理 | ||
- [x] 角色管理 | ||
- [x] 审计日志 | ||
- [x] 后台任务 | ||
- [x] 集成事件 | ||
- [x] SinglaR 消息通知(站内信) | ||
- [x] 多语言 | ||
- [x] 数据字典 | ||
- [x] 容器化部署 | ||
- [x] 单元测试 | ||
- [x] ES 日志 | ||
- [x] Setting 管理 | ||
- [x] 多租户 | ||
- [x] 文件管理 | ||
- [x] 多语言管理 | ||
|
||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/4.4/4.4login.png) | ||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/01.png) | ||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/02.png) | ||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/03.png) | ||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/04.png) | ||
![](https://blog-resouce.oss-cn-shenzhen.aliyuncs.com/images/abp/05.png) | ||
Abp vNext Pro 是一个基于 Vben Admin, Abp vNext 打造的一个开箱即用的中后台管理系统解决方案。觉得该项目对您有帮助,请再 Github 上给我一颗:octicons-heart-fill-24:{ .heart } | ||
|
||
[快速开始 :fontawesome-solid-paper-plane:](user-guide/zh/getting-started/quick-start.md){ .md-button } | ||
|
||
## Abp Vnext Pro | ||
|
||
[演示 :fontawesome-solid-paper-plane:](http://116.205.177.85/login){ .md-button } | ||
[GitHub :fontawesome-solid-paper-plane:](https://github.com/WangJunZzz/abp-vnext-pro){ .md-button } | ||
|
||
## Abp Vnext Pro Suite | ||
|
||
> 基于 Abp Vnext Pro 开发的代码生成器,可自动生成前后端 CURD 代码,提供生产力。 | ||
[演示 :fontawesome-solid-paper-plane:](http://116.205.177.85:81/login){ .md-button } | ||
[GitHub :fontawesome-solid-paper-plane:](https://github.com/WangJunZzz/abp-vnext-pro-suite){ .md-button } | ||
|
||
## 视频教程 | ||
|
||
[B 站 :fontawesome-solid-paper-plane:](https://www.bilibili.com/video/BV1pt4y1E7aZ/?spm_id_from=333.337.search-card.all.click&vd_source=963e10b4fc37556dd738bd98e1d46a0f){ .md-button } |
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
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
142 changes: 142 additions & 0 deletions
142
docs/content/user-guide/zh/infrastructure/AutoMapper.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# 对象到对象映射 | ||
|
||
将对象映射到另一个对象是常用并且繁琐重复的工作,大部分情况下两个类都具有相同或相似的属性. ABP 提供了对象到对象映射的抽象并集成了[AutoMapper](http://automapper.org/)做为对象映射器. | ||
|
||
## AutoMapper 集成 | ||
|
||
[AutoMapper](http://automapper.org/) 是最流行的对象到对象映射库之一. [Volo.Abp.AutoMapper](https://www.nuget.org/packages/Volo.Abp.AutoMapper)程序包使用 AutoMapper 实现了 `IObjectMapper`. | ||
|
||
### 定义映射 | ||
|
||
AutoMapper 提供了多种定义类之间映射的方法. 有关详细信息请参阅[AutoMapper 的文档](https://docs.automapper.org). | ||
|
||
其中定义一种映射的方法是创建一个[Profile](https://docs.automapper.org/en/stable/Configuration.html#profile-instances) 类. 例如: | ||
|
||
```csharp | ||
public class MyProfile : Profile | ||
{ | ||
public MyProfile() | ||
{ | ||
CreateMap<User, UserDto>(); | ||
} | ||
} | ||
``` | ||
|
||
然后使用`AbpAutoMapperOptions`注册配置文件: | ||
|
||
```csharp | ||
[DependsOn(typeof(AbpAutoMapperModule))] | ||
public class MyModule : AbpModule | ||
{ | ||
public override void ConfigureServices(ServiceConfigurationContext context) | ||
{ | ||
Configure<AbpAutoMapperOptions>(options => | ||
{ | ||
//Add all mappings defined in the assembly of the MyModule class | ||
options.AddMaps<MyModule>(); | ||
}); | ||
} | ||
} | ||
``` | ||
|
||
`AddMaps` 注册给定类的程序集中所有的配置类,通常使用模块类. 它还会注册 [attribute 映射](https://docs.automapper.org/en/stable/Attribute-mapping.html). | ||
|
||
### 配置验证 | ||
|
||
`AddMaps` 使用可选的 `bool` 参数控制[模块](Module-Development-Basics.md)的[配置验证](https://docs.automapper.org/en/stable/Configuration-validation.html): | ||
|
||
```csharp | ||
options.AddMaps<MyModule>(validate: true); | ||
``` | ||
|
||
如果此选项默认是 `false` , 但最佳实践建议启用. | ||
可以使用 `AddProfile` 而不是 `AddMaps` 来控制每个配置文件类的配置验证: | ||
|
||
```csharp | ||
options.AddProfile<MyProfile>(validate: true); | ||
``` | ||
|
||
> 如果你有多个配置文件,并且只需要为其中几个启用验证,那么首先使用`AddMaps`而不进行验证,然后为你想要验证的每个配置文件使用`AddProfile`. | ||
### 映射对象扩展 | ||
|
||
[对象扩展系统](Object-Extensions.md) 允许为已存在的类定义额外属性. ABP 框架提供了一个映射定义扩展可以正确的映射两个对象的额外属性. | ||
|
||
```csharp | ||
public class MyProfile : Profile | ||
{ | ||
public MyProfile() | ||
{ | ||
CreateMap<User, UserDto>() | ||
.MapExtraProperties(); | ||
} | ||
} | ||
``` | ||
|
||
如果两个类都是可扩展对象(实现了 `IHasExtraProperties` 接口),建议使用 `MapExtraProperties` 方法. 更多信息请参阅[对象扩展文档](Object-Extensions.md). | ||
|
||
### 其他有用的扩展方法 | ||
|
||
有一些扩展方法可以简化映射代码. | ||
|
||
#### 忽视审计属性 | ||
|
||
当你将一个对象映射到另一个对象时,通常会忽略审核属性. | ||
|
||
假设你需要将 `ProductDto` ([DTO](Data-Transfer-Objects.md))映射到 Product[实体](Entities.md),该实体是从 `AuditedEntity` 类继承的(该类提供了 `CreationTime`, `CreatorId`, `IHasModificationTime` 等属性). | ||
|
||
从 DTO 映射时你可能想忽略这些基本属性,可以使用 `IgnoreAuditedObjectPropertie()` 方法忽略所有审计属性(而不是手动逐个忽略它们): | ||
|
||
```csharp | ||
public class MyProfile : Profile | ||
{ | ||
public MyProfile() | ||
{ | ||
CreateMap<ProductDto, Product>() | ||
.IgnoreAuditedObjectProperties(); | ||
} | ||
} | ||
``` | ||
|
||
还有更多扩展方法, 如 `IgnoreFullAuditedObjectProperties()` 和 `IgnoreCreationAuditedObjectProperties()`,你可以根据实体类型使用. | ||
|
||
> 请参阅[实体文档](Entities.md)中的"_基类和接口的审计属性_"部分了解有关审计属性的更多信息。 | ||
#### 忽视其他属性 | ||
|
||
在 AutoMapper 中,通常可以编写这样的映射代码来忽略属性: | ||
|
||
```csharp | ||
public class MyProfile : Profile | ||
{ | ||
public MyProfile() | ||
{ | ||
CreateMap<SimpleClass1, SimpleClass2>() | ||
.ForMember(x => x.CreationTime, map => map.Ignore()); | ||
} | ||
} | ||
``` | ||
|
||
我们发现它的长度是不必要的并且创建了 `Ignore()` 扩展方法: | ||
|
||
```csharp | ||
public class MyProfile : Profile | ||
{ | ||
public MyProfile() | ||
{ | ||
CreateMap<SimpleClass1, SimpleClass2>() | ||
.Ignore(x => x.CreationTime); | ||
} | ||
} | ||
``` | ||
|
||
## 使用 | ||
|
||
```csharp | ||
// 注入IObjectMapper | ||
public virtual async Task<LanguageDto> GetAsync(string cultureName) | ||
{ | ||
var entity = await _languageRepository.FindAsync(cultureName); | ||
return ObjectMapper.Map<Language, LanguageDto>(entity); | ||
} | ||
``` |
Oops, something went wrong.