|
|
@ -112,6 +112,31 @@ Configure<FileServiceOptions>(options => |
|
|
|
|
|
|
|
|
|
|
|
`config.SetAliasAndTitle("活动项", contestItem => contestItem.ContestItemName)` |
|
|
|
`config.SetAliasAndTitle("活动项", contestItem => contestItem.ContestItemName)` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 文件统计策略 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
目前实体中包含文件提供了两种策略进行统计。 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- `RichTextStatisticsStrategy` 富文本统计策略,用于文件信息存储在`string`类型的属性中。 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- `EntityHasFileIdStatisticsStrategy` 实体存储了所用文件的 Id。需要配合 `IHasFileIdObject` 接口一起使用(~~或者实体属性中包含`FileId`查找,未实现~~)。 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
使用`AddHasUploadContentEntity` 默认配置是 `RichTextStatisticsStrategy`,可通过泛型方式使用其他策略,如下所示: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```csharp |
|
|
|
|
|
|
|
Configure<FileServiceOptions>(options => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
options.AddEntityConfig<BeiKe>(config => |
|
|
|
|
|
|
|
config.Root("二次备课", design => design.Name)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
options.AddHasUploadContentEntity<BeiKeFile, EntityHasFileIdStatisticsStrategy>(config => |
|
|
|
|
|
|
|
config.Parent<BeiKe>(bkFile => bkFile.BeiKeId)); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 多主键实体 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
比如上面策略的代码中 `BeiKeFile` 实体是多主键的。该实体多个主键必须都是`Guid`类型的,否则在查找实体时,则会异常。 |
|
|
|
|
|
|
|
|
|
|
|
# 投票 |
|
|
|
# 投票 |
|
|
|
|
|
|
|
|
|
|
|
## 代码结构 |
|
|
|
## 代码结构 |
|
|
|