149 changed files with 2213 additions and 1819 deletions
@ -1,21 +0,0 @@ |
|||||
import { defHttp } from '/@/utils/http/axios'; |
|
||||
import { IApplicationConfiguration } from './model/appModel'; |
|
||||
import { ApplicationApiDescriptionModel } from './model/apiDefinition'; |
|
||||
|
|
||||
enum Api { |
|
||||
ApplicationConfiguration = '/api/abp/application-configuration', |
|
||||
ApiDefinition = '/api/abp/api-definition', |
|
||||
} |
|
||||
|
|
||||
export const getApplicationConfiguration = () => { |
|
||||
return defHttp.get<IApplicationConfiguration>({ |
|
||||
url: Api.ApplicationConfiguration, |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
export const getApiDefinition = (includeTypes = false) => { |
|
||||
return defHttp.get<ApplicationApiDescriptionModel>({ |
|
||||
url: Api.ApiDefinition, |
|
||||
params: { includeTypes: includeTypes }, |
|
||||
}); |
|
||||
}; |
|
||||
@ -0,0 +1,11 @@ |
|||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||
|
import { ApplicationApiDescriptionModel } from './model'; |
||||
|
|
||||
|
export const GetAsyncByModel = (model?: { |
||||
|
includeTypes?: boolean; |
||||
|
}) => { |
||||
|
return defHttp.get<ApplicationApiDescriptionModel>({ |
||||
|
url: '/api/abp/api-definition', |
||||
|
params: model, |
||||
|
}); |
||||
|
}; |
||||
@ -0,0 +1,10 @@ |
|||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||
|
|
||||
|
export const GetAsyncByOptions = (options?: { |
||||
|
includeLocalizationResources?: boolean; |
||||
|
}) => { |
||||
|
return defHttp.get<ApplicationConfigurationDto>({ |
||||
|
url: '/api/abp/application-configuration', |
||||
|
params: options, |
||||
|
}); |
||||
|
}; |
||||
@ -0,0 +1,11 @@ |
|||||
|
import { defHttp } from '/@/utils/http/axios'; |
||||
|
|
||||
|
export const GetAsyncByInput = (input: { |
||||
|
cultureName: string; |
||||
|
onlyDynamics?: boolean; |
||||
|
}) => { |
||||
|
return defHttp.get<ApplicationLocalizationDto>({ |
||||
|
url: 'api/abp/application-localization"', |
||||
|
params: input, |
||||
|
}); |
||||
|
}; |
||||
@ -1,243 +0,0 @@ |
|||||
import { Available } from '../../model/baseModel'; |
|
||||
|
|
||||
/** 授权 */ |
|
||||
export class Auth { |
|
||||
/** 权限集合 */ |
|
||||
policies?: { [key: string]: boolean } = {}; |
|
||||
/** 已授权集合 */ |
|
||||
grantedPolicies?: { [key: string]: boolean } = {}; |
|
||||
} |
|
||||
|
|
||||
/** 当前租户 */ |
|
||||
export class CurrentTenant { |
|
||||
/** 标识 */ |
|
||||
id? = ''; |
|
||||
/** 名称 */ |
|
||||
name? = ''; |
|
||||
/** 是否可用 */ |
|
||||
isAvailable = false; |
|
||||
|
|
||||
public clear() { |
|
||||
this.id = ''; |
|
||||
this.name = ''; |
|
||||
this.isAvailable = false; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** 当前用户 */ |
|
||||
export class CurrentUser { |
|
||||
/** 标识 */ |
|
||||
id? = ''; |
|
||||
/** 邮件地址 */ |
|
||||
email? = ''; |
|
||||
/** 邮件已验证 */ |
|
||||
emailVerified = false; |
|
||||
/** 手机号 */ |
|
||||
phoneNumber? = ''; |
|
||||
/** 手机号已验证 */ |
|
||||
phoneNumberVerified = false; |
|
||||
/** 名称 */ |
|
||||
name? = ''; |
|
||||
/** 简称 */ |
|
||||
surName? = ''; |
|
||||
/** 用户名 */ |
|
||||
userName? = ''; |
|
||||
/** 所属租户 */ |
|
||||
tenantId? = ''; |
|
||||
/** 是否已认证 */ |
|
||||
isAuthenticated = false; |
|
||||
/** 所属角色列表 */ |
|
||||
roles = new Array<string>(); |
|
||||
} |
|
||||
|
|
||||
/** 功能 */ |
|
||||
export class Feature { |
|
||||
/** 功能集合 */ |
|
||||
values?: { [key: string]: string } = {}; |
|
||||
} |
|
||||
|
|
||||
/** 时区转换 */ |
|
||||
export class DateTimeFormat { |
|
||||
/** 日历算法 */ |
|
||||
calendarAlgorithmType = ''; |
|
||||
/** 日期分隔符 */ |
|
||||
dateSeparator = ''; |
|
||||
/** 日期时间格式 */ |
|
||||
dateTimeFormatLong = ''; |
|
||||
/** 完整日期时间格式 */ |
|
||||
fullDateTimePattern = ''; |
|
||||
/** 长时间格式 */ |
|
||||
longTimePattern = ''; |
|
||||
/** 短日期格式 */ |
|
||||
shortDatePattern = ''; |
|
||||
/** 短时间格式 */ |
|
||||
shortTimePattern = ''; |
|
||||
} |
|
||||
|
|
||||
/** 当前区域信息 */ |
|
||||
export class CurrentCulture { |
|
||||
/** 本地化名称 */ |
|
||||
cultureName = ''; |
|
||||
/** 显示名称 */ |
|
||||
displayName = ''; |
|
||||
/** 英文名称 */ |
|
||||
englishName = ''; |
|
||||
/** 是否从右到左 */ |
|
||||
isRightToLeft = false; |
|
||||
/** 名称 */ |
|
||||
name = ''; |
|
||||
/** 本地名称 */ |
|
||||
nativeName = ''; |
|
||||
/** 三个字母的ISO名称 */ |
|
||||
threeLetterIsoLanguageName = ''; |
|
||||
/** 两个字母的ISO名称 */ |
|
||||
twoLetterIsoLanguageName = ''; |
|
||||
/** 日期时间格式 */ |
|
||||
dateTimeFormat = new DateTimeFormat(); |
|
||||
} |
|
||||
|
|
||||
/** 语言 */ |
|
||||
export class Language { |
|
||||
/** 本地化名称 */ |
|
||||
cultureName = ''; |
|
||||
/** 显示名称 */ |
|
||||
displayName = ''; |
|
||||
/** 图标 */ |
|
||||
flagIcon = ''; |
|
||||
/** 用户界面本地化名称 */ |
|
||||
uiCultureName = ''; |
|
||||
} |
|
||||
|
|
||||
/** 本地化 */ |
|
||||
export class Localization { |
|
||||
/** 当前区域 */ |
|
||||
currentCulture = new CurrentCulture(); |
|
||||
/** 默认本地化资源名称 */ |
|
||||
defaultResourceName = ''; |
|
||||
/** 支持的语言列表 */ |
|
||||
languages = new Array<Language>(); |
|
||||
/** 本地化资源集合 */ |
|
||||
values: { [key: string]: { [key: string]: string } } = {}; |
|
||||
/** 语言映射集合 */ |
|
||||
languagesMap: { [key: string]: NameValue<string>[] } = {}; |
|
||||
/** 语言文档映射集合 */ |
|
||||
languageFilesMap: { [key: string]: NameValue<string>[] } = {}; |
|
||||
} |
|
||||
|
|
||||
/** 多租户配置 */ |
|
||||
export class MultiTenancy { |
|
||||
/** 是否启用多租户 */ |
|
||||
isEnabled = false; |
|
||||
} |
|
||||
|
|
||||
/** 全局设置 */ |
|
||||
export class Setting { |
|
||||
/** 设置集合 */ |
|
||||
values: { [key: string]: string } = {}; |
|
||||
} |
|
||||
|
|
||||
/** 实体查询属性扩展 */ |
|
||||
export class ExtensionPropertyApiGet extends Available {} |
|
||||
|
|
||||
/** 实体创建属性扩展 */ |
|
||||
export class ExtensionPropertyApiCreate extends Available {} |
|
||||
|
|
||||
/** 实体更新属性扩展 */ |
|
||||
export class ExtensionPropertyApiUpdate extends Available {} |
|
||||
|
|
||||
/** 实体属性api定义 */ |
|
||||
export class ExtensionPropertyApi { |
|
||||
/** 查询时 */ |
|
||||
onGet = new ExtensionPropertyApiGet(); |
|
||||
/** 创建时 */ |
|
||||
onCreate = new ExtensionPropertyApiCreate(); |
|
||||
/** 更新时 */ |
|
||||
onUpdate = new ExtensionPropertyApiUpdate(); |
|
||||
} |
|
||||
|
|
||||
export class ExtensionPropertyUiTable extends Available {} |
|
||||
|
|
||||
export class ExtensionPropertyUiForm extends Available {} |
|
||||
|
|
||||
export class ExtensionPropertyUi { |
|
||||
onTable = new ExtensionPropertyUiTable(); |
|
||||
onCreateForm = new ExtensionPropertyUiForm(); |
|
||||
onEditForm = new ExtensionPropertyUiForm(); |
|
||||
} |
|
||||
|
|
||||
export class LocalizableString { |
|
||||
name = ''; |
|
||||
resource = ''; |
|
||||
} |
|
||||
|
|
||||
export class ExtensionPropertyAttribute { |
|
||||
typeSimple = ''; |
|
||||
config: { [key: string]: any } = {}; |
|
||||
} |
|
||||
|
|
||||
export class ExtensionProperty { |
|
||||
type = ''; |
|
||||
typeSimple = ''; |
|
||||
displayName = new LocalizableString(); |
|
||||
api = new ExtensionPropertyApi(); |
|
||||
ui = new ExtensionPropertyUi(); |
|
||||
attributes = new Array<ExtensionPropertyAttribute>(); |
|
||||
configuration: { [key: string]: any } = {}; |
|
||||
defaultValue: any = ''; |
|
||||
} |
|
||||
|
|
||||
export class EntityExtension { |
|
||||
properties: { [key: string]: ExtensionProperty } = {}; |
|
||||
configuration: { [key: string]: any } = {}; |
|
||||
} |
|
||||
|
|
||||
export class ModuleExtension { |
|
||||
entities: { [key: string]: EntityExtension } = {}; |
|
||||
configuration: { [key: string]: any } = {}; |
|
||||
} |
|
||||
|
|
||||
export class ExtensionEnumField { |
|
||||
name = ''; |
|
||||
value: any = ''; |
|
||||
} |
|
||||
|
|
||||
export class ExtensionEnum { |
|
||||
fields = new Array<ExtensionEnumField>(); |
|
||||
localizationResource = ''; |
|
||||
} |
|
||||
|
|
||||
export class ObjectExtension { |
|
||||
modules: { [key: string]: ModuleExtension } = {}; |
|
||||
enums: { [key: string]: ExtensionEnum } = {}; |
|
||||
} |
|
||||
|
|
||||
/** abp框架信息 */ |
|
||||
export interface IApplicationConfiguration { |
|
||||
/** 授权 */ |
|
||||
auth: Auth; |
|
||||
/** 租户 */ |
|
||||
currentTenant: CurrentTenant; |
|
||||
/** 用户 */ |
|
||||
currentUser: CurrentUser; |
|
||||
/** 功能 */ |
|
||||
features: Feature; |
|
||||
/** 本地化 */ |
|
||||
localization: Localization; |
|
||||
/** 租户配置 */ |
|
||||
multiTenancy: MultiTenancy; |
|
||||
/** 对象扩展 */ |
|
||||
objectExtensions: ObjectExtension; |
|
||||
/** 设置 */ |
|
||||
setting: Setting; |
|
||||
} |
|
||||
|
|
||||
export class ApplicationConfiguration implements IApplicationConfiguration { |
|
||||
auth = new Auth(); |
|
||||
currentTenant = new CurrentTenant(); |
|
||||
currentUser = new CurrentUser(); |
|
||||
features = new Feature(); |
|
||||
localization = new Localization(); |
|
||||
multiTenancy = new MultiTenancy(); |
|
||||
objectExtensions = new ObjectExtension(); |
|
||||
setting = new Setting(); |
|
||||
} |
|
||||
@ -0,0 +1,33 @@ |
|||||
|
import { computed } from 'vue'; |
||||
|
import { useAbpStoreWithOut } from '/@/store/modules/abp'; |
||||
|
|
||||
|
interface PermissionChecker { |
||||
|
isGranted(name: string | string[]): boolean; |
||||
|
authorize(name: string | string[]): void; |
||||
|
} |
||||
|
|
||||
|
export function useAuthorization(): PermissionChecker { |
||||
|
const getGrantedPolicies = computed(() => { |
||||
|
const abpStore = useAbpStoreWithOut(); |
||||
|
return abpStore.getApplication.auth.grantedPolicies ?? {}; |
||||
|
}); |
||||
|
|
||||
|
function isGranted(name: string | string[]): boolean { |
||||
|
const grantedPolicies = getGrantedPolicies.value; |
||||
|
if (Array.isArray(name)) { |
||||
|
return name.every((name) => grantedPolicies[name]); |
||||
|
} |
||||
|
return grantedPolicies[name] |
||||
|
} |
||||
|
|
||||
|
function authorize(name: string | string[]): void { |
||||
|
if (!isGranted(name)) { |
||||
|
throw Error(`Authorization failed! Given policy has not granted: ${name}`); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
isGranted, |
||||
|
authorize, |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
# LINGYUN.Abp.Elsa.Activities |
||||
|
|
||||
|
常用Activity集成 |
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpElsaActivitiesModule) |
||||
|
)] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## appsettings.json |
||||
|
```json |
||||
|
{ |
||||
|
"Elsa": { |
||||
|
"BlobStoring": true, |
||||
|
"Emailing": true, |
||||
|
"Notification": true, |
||||
|
"Sms": true, |
||||
|
"IM": true, |
||||
|
"PublishWebhook": true |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
``` |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,16 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.1</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\common\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.Elsa\LINGYUN.Abp.Elsa.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,17 @@ |
|||||
|
using Elsa; |
||||
|
using LINGYUN.Abp.Notifications; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Elsa.Notifications; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpElsaModule), |
||||
|
typeof(AbpNotificationsModule))] |
||||
|
public class AbpElsaNotificationsModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services |
||||
|
.AddNotificationHandlersFrom<AbpElsaWorkflowNotificationHandler>(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,126 @@ |
|||||
|
using Elsa.Events; |
||||
|
using Elsa.Models; |
||||
|
using Elsa.Services.Models; |
||||
|
using LINGYUN.Abp.Notifications; |
||||
|
using MediatR; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Globalization; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Elsa.Notifications; |
||||
|
|
||||
|
public class AbpElsaWorkflowNotificationHandler : |
||||
|
INotificationHandler<WorkflowFaulted>, |
||||
|
INotificationHandler<WorkflowCancelled>, |
||||
|
INotificationHandler<WorkflowCompleted>, |
||||
|
INotificationHandler<WorkflowSuspended> |
||||
|
{ |
||||
|
public async Task Handle(WorkflowFaulted notification, CancellationToken cancellationToken) |
||||
|
{ |
||||
|
await SendNotifierIfExistsAsync( |
||||
|
notification.WorkflowExecutionContext.GetFaultedNotification(), |
||||
|
notification.WorkflowExecutionContext, |
||||
|
severity: NotificationSeverity.Error); |
||||
|
} |
||||
|
|
||||
|
public async Task Handle(WorkflowCancelled notification, CancellationToken cancellationToken) |
||||
|
{ |
||||
|
await SendNotifierIfExistsAsync( |
||||
|
notification.WorkflowExecutionContext.GetCancelledNotification(), |
||||
|
notification.WorkflowExecutionContext, |
||||
|
severity: NotificationSeverity.Warn); |
||||
|
} |
||||
|
|
||||
|
public async Task Handle(WorkflowCompleted notification, CancellationToken cancellationToken) |
||||
|
{ |
||||
|
await SendNotifierIfExistsAsync( |
||||
|
notification.WorkflowExecutionContext.GetCompletedNotification(), |
||||
|
notification.WorkflowExecutionContext, |
||||
|
severity: NotificationSeverity.Success); |
||||
|
} |
||||
|
|
||||
|
public async Task Handle(WorkflowSuspended notification, CancellationToken cancellationToken) |
||||
|
{ |
||||
|
await SendNotifierIfExistsAsync( |
||||
|
notification.WorkflowExecutionContext.GetSuspendedNotification(), |
||||
|
notification.WorkflowExecutionContext, |
||||
|
severity: NotificationSeverity.Warn); |
||||
|
} |
||||
|
|
||||
|
private async Task SendNotifierIfExistsAsync( |
||||
|
string notificationName, |
||||
|
WorkflowExecutionContext executionContext, |
||||
|
NotificationSeverity severity = NotificationSeverity.Info, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
if (notificationName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var workflowInstance = executionContext.WorkflowInstance; |
||||
|
var workflowBlueprint = executionContext.WorkflowBlueprint; |
||||
|
|
||||
|
var serviceProvider = executionContext.ServiceProvider; |
||||
|
var currentTenant = serviceProvider.GetRequiredService<ICurrentTenant>(); |
||||
|
var notificationSender = serviceProvider.GetRequiredService<INotificationSender>(); |
||||
|
|
||||
|
var notificationData = new Dictionary<string, object> |
||||
|
{ |
||||
|
{ nameof(IActivityBlueprint.Id), workflowBlueprint.Id }, |
||||
|
{ nameof(WorkflowExecutionContext.Status), executionContext.Status }, |
||||
|
}; |
||||
|
if (!workflowBlueprint.Name.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
notificationData.TryAdd(nameof(IActivityBlueprint.Name), workflowBlueprint.Name); |
||||
|
} |
||||
|
if (!workflowBlueprint.DisplayName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
notificationData.TryAdd(nameof(IActivityBlueprint.DisplayName), workflowBlueprint.DisplayName); |
||||
|
} |
||||
|
if (!workflowBlueprint.Description.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
notificationData.TryAdd(nameof(IActivityBlueprint.Description), workflowBlueprint.Description); |
||||
|
} |
||||
|
if (!workflowBlueprint.Type.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
notificationData.TryAdd(nameof(IActivityBlueprint.Type), workflowBlueprint.Type); |
||||
|
} |
||||
|
if (executionContext.Exception != null) |
||||
|
{ |
||||
|
notificationData.TryAdd(nameof(Exception), executionContext.Exception.Message); |
||||
|
} |
||||
|
|
||||
|
var transientData = executionContext.GetNotificationData(); |
||||
|
foreach (var data in transientData) |
||||
|
{ |
||||
|
notificationData.TryAdd(data.Key, data.Value); |
||||
|
} |
||||
|
|
||||
|
var notificationTemplate = new NotificationTemplate( |
||||
|
notificationName, |
||||
|
CultureInfo.CurrentCulture.Name, |
||||
|
data: notificationData); |
||||
|
|
||||
|
await notificationSender.SendNofiterAsync( |
||||
|
notificationName, |
||||
|
notificationTemplate, |
||||
|
tenantId: currentTenant.Id ?? workflowInstance.GetTenantId(), |
||||
|
severity: severity); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
executionContext |
||||
|
.ServiceProvider |
||||
|
.GetService<ILogger<AbpElsaWorkflowNotificationHandler>>() |
||||
|
?.LogWarning("Failed to send a workflow notification, because: {Message}", ex.Message); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.Elsa.Notifications |
||||
|
|
||||
|
工作流通知集成, 当工作流触发后, 发布相应事件通知 |
||||
|
|
||||
|
## 可用状态 |
||||
|
|
||||
|
* Faulted: 工作流执行出现错误 |
||||
|
* Cancelled: 工作流取消 |
||||
|
* Completed: 工作流执行完毕 |
||||
|
* Suspended: 工作流暂停 |
||||
|
|
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpElsaNotificationsModule) |
||||
|
)] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
```csharp |
||||
|
// 定义通知 |
||||
|
public class DemoNotificationDefinitionProvider : NotificationDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(INotificationDefinitionContext context) |
||||
|
{ |
||||
|
var demoGroup = context.AddGroup("Group"); |
||||
|
|
||||
|
// 由于通知的多样性, 需要使用模板消息来传递数据 |
||||
|
demoGroup.AddNotification("Faulted") |
||||
|
.WithTemplate(template => { }); |
||||
|
demoGroup.AddNotification("Cancelled") |
||||
|
.WithTemplate(template => { }); |
||||
|
demoGroup.AddNotification("Suspended") |
||||
|
.WithTemplate(template => { }); |
||||
|
demoGroup.AddNotification("Completed") |
||||
|
.WithTemplate(template => { }); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
// 定义工作流 |
||||
|
public class DemoWorkflow : IWorkflow |
||||
|
{ |
||||
|
public void Build(IWorkflowBuilder builder) |
||||
|
{ |
||||
|
builder |
||||
|
.WithFaultedNotification("Faulted") |
||||
|
.WithCancelledNotification("Cancelled") |
||||
|
.WithSuspendedNotification("Suspended") |
||||
|
.WithCompletedNotification("Completed") |
||||
|
.SetVariable("demo", context => |
||||
|
{ |
||||
|
// 可传递自定义参数, 将作为瞬时变量写入到发布的通知数据中 |
||||
|
context.WithNotificationData("demo", "demo"); |
||||
|
}) |
||||
|
.WriteLine("Start a workflow.") |
||||
|
.WriteLine("Workflow finished."); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,16 @@ |
|||||
|
# LINGYUN.Abp.Elsa.Server |
||||
|
|
||||
|
Elsa.Server.Api集成, 处理elsa默认端点 |
||||
|
|
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpElsaServerModule) |
||||
|
)] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
@ -0,0 +1,31 @@ |
|||||
|
using Elsa.Builders; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Elsa.Notifications; |
||||
|
public static class AbpWorkflowBuilderNotificationsExtensions |
||||
|
{ |
||||
|
internal const string NotificationPrefix = "_Abp_Elsa_Notification_"; |
||||
|
public const string FaultedNotificationKey = NotificationPrefix + "Faulted_"; |
||||
|
public const string CompletedNotificationKey = NotificationPrefix + "Completed_"; |
||||
|
public const string CancelledNotificationKey = NotificationPrefix + "Cancelled_"; |
||||
|
public const string SuspendedNotificationKey = NotificationPrefix + "Suspended_"; |
||||
|
|
||||
|
public static IWorkflowBuilder WithFaultedNotification(this IWorkflowBuilder builder, string notification) |
||||
|
{ |
||||
|
return builder.WithCustomAttribute(FaultedNotificationKey, notification); |
||||
|
} |
||||
|
|
||||
|
public static IWorkflowBuilder WithCompletedNotification(this IWorkflowBuilder builder, string notification) |
||||
|
{ |
||||
|
return builder.WithCustomAttribute(CompletedNotificationKey, notification); |
||||
|
} |
||||
|
|
||||
|
public static IWorkflowBuilder WithCancelledNotification(this IWorkflowBuilder builder, string notification) |
||||
|
{ |
||||
|
return builder.WithCustomAttribute(CancelledNotificationKey, notification); |
||||
|
} |
||||
|
|
||||
|
public static IWorkflowBuilder WithSuspendedNotification(this IWorkflowBuilder builder, string notification) |
||||
|
{ |
||||
|
return builder.WithCustomAttribute(SuspendedNotificationKey, notification); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
using Elsa.Services.Models; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Elsa.Notifications; |
||||
|
public static class AbpWorkflowExecutionContextNotificationsExtensions |
||||
|
{ |
||||
|
private const string NotificationDataKey = AbpWorkflowBuilderNotificationsExtensions.NotificationPrefix + "Data_"; |
||||
|
|
||||
|
public static void WithNotificationData(this ActivityExecutionContext context, string key, object data) |
||||
|
{ |
||||
|
context.WorkflowExecutionContext.SetTransientVariable(key, data); |
||||
|
} |
||||
|
|
||||
|
public static void WithNotificationData(this WorkflowExecutionContext context, string key, object data) |
||||
|
{ |
||||
|
var notificationData = context.GetNotificationData(); |
||||
|
|
||||
|
notificationData.TryAdd(key, data); |
||||
|
|
||||
|
context.SetTransientVariable(NotificationDataKey, notificationData); |
||||
|
} |
||||
|
|
||||
|
public static Dictionary<string, object> GetNotificationData(this ActivityExecutionContext context) |
||||
|
{ |
||||
|
return context.WorkflowExecutionContext.GetNotificationData(); |
||||
|
} |
||||
|
|
||||
|
public static Dictionary<string, object> GetNotificationData(this WorkflowExecutionContext context) |
||||
|
{ |
||||
|
var notificationData = context.GetTransientVariable<Dictionary<string, object>>(NotificationDataKey); |
||||
|
notificationData ??= new Dictionary<string, object>(); |
||||
|
|
||||
|
return notificationData; |
||||
|
} |
||||
|
|
||||
|
public static string? GetFaultedNotification(this WorkflowExecutionContext context) |
||||
|
{ |
||||
|
return context.WorkflowBlueprint.CustomAttributes |
||||
|
.Get<string>(AbpWorkflowBuilderNotificationsExtensions.FaultedNotificationKey); |
||||
|
} |
||||
|
|
||||
|
public static string? GetCompletedNotification(this WorkflowExecutionContext context) |
||||
|
{ |
||||
|
return context.WorkflowBlueprint.CustomAttributes |
||||
|
.Get<string>(AbpWorkflowBuilderNotificationsExtensions.CompletedNotificationKey); |
||||
|
} |
||||
|
|
||||
|
public static string? GetSuspendedNotification(this WorkflowExecutionContext context) |
||||
|
{ |
||||
|
return context.WorkflowBlueprint.CustomAttributes |
||||
|
.Get<string>(AbpWorkflowBuilderNotificationsExtensions.SuspendedNotificationKey); |
||||
|
} |
||||
|
|
||||
|
public static string? GetCancelledNotification(this WorkflowExecutionContext context) |
||||
|
{ |
||||
|
return context.WorkflowBlueprint.CustomAttributes |
||||
|
.Get<string>(AbpWorkflowBuilderNotificationsExtensions.CancelledNotificationKey); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
# LINGYUN.Abp.Elsa |
||||
|
|
||||
|
[elsa-core](https://github.com/elsa-workflows/elsa-core) 工作流的abp集成 |
||||
|
|
||||
|
## 特性 |
||||
|
|
||||
|
* 提供默认**AbpActivity**与多租户集成 |
||||
|
* 定义**AbpTenantAccessor**与多租户集成 |
||||
|
* 定义**AbpElsaIdGenerator**通过**IGuidGenerator**接口生成工作流标识 |
||||
|
* 定义**abp**相关JavaScript扩展 |
||||
|
|
||||
|
## 配置使用 |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpElsaModule) |
||||
|
)] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<ElsaOptionsBuilder>(elsa => |
||||
|
{ |
||||
|
// 自定义elsa相关配置 |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
@ -1,8 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class Class1 |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,8 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.Application |
|
||||
{ |
|
||||
public class Class1 |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,19 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Auditing" Version="4.4.0" /> |
|
||||
<PackageReference Include="Volo.Abp.Validation" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\Localization\Resources\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,28 +0,0 @@ |
|||||
using LINGYUN.Abp.RulesManagement.Localization; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.Validation; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpValidationModule))] |
|
||||
public class AbpRulesManagementDomainSharedModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<AbpVirtualFileSystemOptions>(options => |
|
||||
{ |
|
||||
options.FileSets.AddEmbedded<AbpRulesManagementDomainSharedModule>(); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Resources |
|
||||
.Add<RulesResource>() |
|
||||
.AddVirtualJson("/LINGYUN/Abp/RulesManagement/Localization/Resources"); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public static class EntityRuleConsts |
|
||||
{ |
|
||||
public static int MaxNameLength { get; set; } = 64; |
|
||||
public static int MaxDisplayNameLength { get; set; } = 256; |
|
||||
public static int MaxOperatorLength { get; set; } = 64; |
|
||||
public static int MaxErrorMessageLength { get; set; } = 256; |
|
||||
public static int MaxExpressionLength { get; set; } = 1024; |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
using System; |
|
||||
using Volo.Abp.Auditing; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleEto : IMultiTenant, ICreationAuditedObject, IModificationAuditedObject |
|
||||
{ |
|
||||
public Guid Id { get; set; } |
|
||||
public Guid? TenantId { get; set; } |
|
||||
public string Name { get; set; } |
|
||||
public string DisplayName { get; set; } |
|
||||
public Guid? LastModifierId { get; set; } |
|
||||
public DateTime? LastModificationTime { get; set; } |
|
||||
public DateTime CreationTime { get; set; } |
|
||||
public Guid? CreatorId { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public static class EntityRuleGroupConsts |
|
||||
{ |
|
||||
public static int MaxNameLength { get; set; } = 64; |
|
||||
public static int MaxDisplayNameLength { get; set; } = 256; |
|
||||
public static int MaxEntiyFullTypeNameLength { get; set; } = 256; |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
using System; |
|
||||
using Volo.Abp.Auditing; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleGroupEto : IMultiTenant, ICreationAuditedObject, IModificationAuditedObject |
|
||||
{ |
|
||||
public Guid Id { get; set; } |
|
||||
public Guid? TenantId { get; set; } |
|
||||
public string Name { get; set; } |
|
||||
public string DisplayName { get; set; } |
|
||||
public Guid? LastModifierId { get; set; } |
|
||||
public DateTime? LastModificationTime { get; set; } |
|
||||
public DateTime CreationTime { get; set; } |
|
||||
public Guid? CreatorId { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public static class EntityRuleParamConsts |
|
||||
{ |
|
||||
public static int MaxNameLength { get; set; } = 64; |
|
||||
public static int MaxExpressionLength { get; set; } = 1024; |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.Localization |
|
||||
{ |
|
||||
[LocalizationResourceName("AbpRulesManagement")] |
|
||||
public class RulesResource |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,20 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AutoMapper" Version="4.4.0" /> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\common\LINGYUN.Abp.Rules\LINGYUN.Abp.Rules.csproj" /> |
|
||||
<ProjectReference Include="..\LINGYUN.Abp.RulesManagement.Domain.Shared\LINGYUN.Abp.RulesManagement.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,31 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.AutoMapper; |
|
||||
using Volo.Abp.Domain; |
|
||||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpDddDomainModule), |
|
||||
typeof(AbpAutoMapperModule), |
|
||||
typeof(AbpRulesManagementDomainSharedModule))] |
|
||||
public class AbpRulesManagementDomainModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAutoMapperObjectMapper<AbpRulesManagementDomainModule>(); |
|
||||
|
|
||||
Configure<AbpAutoMapperOptions>(options => |
|
||||
{ |
|
||||
options.AddProfile<RulesManagementMapperProfile>(validate: true); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpDistributedEntityEventOptions>(options => |
|
||||
{ |
|
||||
options.EtoMappings.Add<EntityRule, EntityRuleEto>(typeof(AbpRulesManagementDomainModule)); |
|
||||
options.EtoMappings.Add<EntityRuleInGroup, EntityRuleGroupEto>(typeof(AbpRulesManagementDomainModule)); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,163 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using LINGYUN.Abp.Rules; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Collections.ObjectModel; |
|
||||
using System.Linq; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
using Volo.Abp.Guids; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRule : FullAuditedAggregateRoot<Guid>, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 规则名称
|
|
||||
/// </summary>
|
|
||||
public virtual string Name { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 显示名称
|
|
||||
/// </summary>
|
|
||||
public virtual string DisplayName { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 操作类型
|
|
||||
/// </summary>
|
|
||||
public virtual string Operator { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 错误提示
|
|
||||
/// </summary>
|
|
||||
public virtual string ErrorMessage { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 错误类型
|
|
||||
/// </summary>
|
|
||||
public virtual ErrorType ErrorType { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 表达式类型
|
|
||||
/// </summary>
|
|
||||
public virtual ExpressionType? ExpressionType { get; set; } |
|
||||
/// <summary>
|
|
||||
/// 所属规则
|
|
||||
/// </summary>
|
|
||||
public virtual Guid? ParentId { get; protected set; } |
|
||||
|
|
||||
public virtual ICollection<EntitySubRule> SubRules { get; protected set; } |
|
||||
public virtual ICollection<EntityRuleInject> InjectRules { get; protected set; } |
|
||||
public virtual ICollection<EntityRuleParam> Params { get; protected set; } |
|
||||
public virtual string Expression { get; protected set; } |
|
||||
|
|
||||
protected EntityRule() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public EntityRule( |
|
||||
[NotNull] Guid id, |
|
||||
[NotNull] string name, |
|
||||
[CanBeNull] string operation, |
|
||||
[CanBeNull] string displayName, |
|
||||
[CanBeNull] Guid? parentId = null, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(id, nameof(id)); |
|
||||
Check.NotNullOrWhiteSpace(name, nameof(name), EntityRuleConsts.MaxNameLength); |
|
||||
|
|
||||
Id = id; |
|
||||
Name = name; |
|
||||
Operator = operation; |
|
||||
DisplayName = displayName; |
|
||||
ParentId = parentId; |
|
||||
TenantId = tenantId; |
|
||||
|
|
||||
ExpressionType = Abp.Rules.ExpressionType.LambdaExpression; |
|
||||
|
|
||||
Params = new Collection<EntityRuleParam>(); |
|
||||
SubRules = new Collection<EntitySubRule>(); |
|
||||
InjectRules = new Collection<EntityRuleInject>(); |
|
||||
ExtraProperties = new Dictionary<string, object>(); |
|
||||
} |
|
||||
|
|
||||
public virtual void SetErrorInfomation(string errorMessage, ErrorType errorType = ErrorType.Warning) |
|
||||
{ |
|
||||
ErrorType = errorType; |
|
||||
ErrorMessage = errorMessage; |
|
||||
} |
|
||||
|
|
||||
public virtual void AddParamter([NotNull] IGuidGenerator guidGenerator, [NotNull] string name, [NotNull] string expression) |
|
||||
{ |
|
||||
Check.NotNull(guidGenerator, nameof(guidGenerator)); |
|
||||
|
|
||||
if (Params.Any(p => p.Name == name)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
Params.Add(new EntityRuleParam(guidGenerator.Create(), Id, name, expression, TenantId)); |
|
||||
} |
|
||||
|
|
||||
public virtual void RemoveParamter([NotNull] string name) |
|
||||
{ |
|
||||
Check.NotNullOrWhiteSpace(name, nameof(name)); |
|
||||
|
|
||||
Params.RemoveAll(p => p.Name == name); |
|
||||
} |
|
||||
|
|
||||
public virtual void AddInjectRule([NotNull] EntityRule rule) |
|
||||
{ |
|
||||
Check.NotNull(rule, nameof(rule)); |
|
||||
if (IsInjectRule(rule.Id)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
InjectRules.Add(new EntityRuleInject(rule.Id, Id, TenantId)); |
|
||||
} |
|
||||
|
|
||||
public virtual void RemoveInjectRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
if (IsInjectRule(ruleId)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
InjectRules.RemoveAll(rule => rule.RuleId == ruleId); |
|
||||
} |
|
||||
|
|
||||
public virtual bool IsInjectRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
return InjectRules.Any(rule => rule.RuleId == ruleId); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public virtual void AddSubRule([NotNull] EntityRule rule) |
|
||||
{ |
|
||||
Check.NotNull(rule, nameof(rule)); |
|
||||
|
|
||||
if (IsInRule(rule.Id)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
SubRules.Add(new EntitySubRule(Id, rule.Id, TenantId)); |
|
||||
} |
|
||||
|
|
||||
public virtual void RemoveSubRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
if (!IsInRule(ruleId)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
SubRules.RemoveAll(r => r.SubId == ruleId); |
|
||||
} |
|
||||
|
|
||||
public virtual bool IsInRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
return SubRules.Any(r => r.SubId == ruleId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,34 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
using Volo.Abp.Guids; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleDataSeeder : IEntityRuleDataSeeder, ITransientDependency |
|
||||
{ |
|
||||
protected IGuidGenerator GuidGenerator { get; } |
|
||||
protected ICurrentTenant CurrentTenant { get; } |
|
||||
protected IEntityRuleGroupRepository Repository { get; } |
|
||||
|
|
||||
public EntityRuleDataSeeder( |
|
||||
IGuidGenerator guidGenerator, |
|
||||
ICurrentTenant currentTenant, |
|
||||
IEntityRuleGroupRepository repository) |
|
||||
{ |
|
||||
GuidGenerator = guidGenerator; |
|
||||
CurrentTenant = currentTenant; |
|
||||
Repository = repository; |
|
||||
} |
|
||||
|
|
||||
public async virtual Task SeedAsync(EntityRuleInGroup group) |
|
||||
{ |
|
||||
var findGroup = await Repository.GetByNameAsync(group.Name); |
|
||||
if (findGroup != null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
await Repository.InsertAsync(group); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,131 +0,0 @@ |
|||||
using LINGYUN.Abp.Rules; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
using Volo.Abp.Domain.Services; |
|
||||
using Volo.Abp.ObjectMapping; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)] |
|
||||
[ExposeServices(typeof(IRuleFinder))] |
|
||||
public class EntityRuleFinder : DomainService, IRuleFinder |
|
||||
{ |
|
||||
private IObjectMapper _objectMapper; |
|
||||
protected IObjectMapper ObjectMapper => LazyGetRequiredService(ref _objectMapper); |
|
||||
|
|
||||
private IEntityRuleGroupRepository _ruleGroupRepository; |
|
||||
protected IEntityRuleGroupRepository RuleGroupRepository => LazyGetRequiredService(ref _ruleGroupRepository); |
|
||||
|
|
||||
private IEntityRuleRepository _rruleRepository; |
|
||||
protected IEntityRuleRepository RuleRepository => LazyGetRequiredService(ref _rruleRepository); |
|
||||
|
|
||||
public async virtual Task<List<RuleGroup>> GetRuleGroupsAsync(Type entityType) |
|
||||
{ |
|
||||
var entityFullTypeName = entityType.FullName; |
|
||||
if (entityType.IsGenericType) |
|
||||
{ |
|
||||
entityFullTypeName = entityType.GetGenericTypeDefinition().FullName; |
|
||||
} |
|
||||
else if (entityType.IsArray) |
|
||||
{ |
|
||||
entityFullTypeName = entityType.GetElementType().FullName; |
|
||||
} |
|
||||
var entityRuleGroups = await RuleGroupRepository.GetListByTypeAsync(entityFullTypeName, includeDetails: true); |
|
||||
|
|
||||
var ruleGroups = ObjectMapper.Map<List<EntityRuleGroup>, List<RuleGroup>>(entityRuleGroups); |
|
||||
|
|
||||
foreach(var group in ruleGroups) |
|
||||
{ |
|
||||
var entityRuleGroup = entityRuleGroups.Find(g => g.Name.Equals(group.Name)); |
|
||||
if (entityRuleGroup != null) |
|
||||
{ |
|
||||
foreach(var ruleInGroup in entityRuleGroup.Rules) |
|
||||
{ |
|
||||
await AddRuleAsync(group, ruleInGroup.RuleId); |
|
||||
} |
|
||||
|
|
||||
foreach(var ruleInject in entityRuleGroup.InjectRules) |
|
||||
{ |
|
||||
await AddToInjectRuleAsync(group, ruleInject.RuleId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return ruleGroups; |
|
||||
} |
|
||||
|
|
||||
protected async virtual Task AddRuleAsync(RuleGroup ruleGroup, Guid ruleId) |
|
||||
{ |
|
||||
var entityRule = await RuleRepository.FindAsync(ruleId); |
|
||||
if (entityRule == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
var rule = ObjectMapper.Map<EntityRule, Rule>(entityRule); |
|
||||
ruleGroup.WithRule(rule); |
|
||||
|
|
||||
foreach (var subEntityRule in entityRule.SubRules) |
|
||||
{ |
|
||||
await AddSubRuleAsync(rule, subEntityRule.SubId); |
|
||||
} |
|
||||
|
|
||||
foreach (var ruleInject in entityRule.InjectRules) |
|
||||
{ |
|
||||
// 如果依赖于某个规则,需要把此规则添加到集合
|
|
||||
await AddRuleAsync(ruleGroup, ruleInject.InjectId); |
|
||||
|
|
||||
// 添加依赖规则
|
|
||||
await AddToInjectRuleAsync(ruleGroup, ruleInject.InjectId); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected async virtual Task AddSubRuleAsync(Rule rule, Guid subRuleId) |
|
||||
{ |
|
||||
var entityRule = await RuleRepository.FindAsync(subRuleId); |
|
||||
if (entityRule == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
var subRule = ObjectMapper.Map<EntityRule, Rule>(entityRule); |
|
||||
rule.CreateChildren(subRule); |
|
||||
foreach (var subEntityRule in entityRule.SubRules) |
|
||||
{ |
|
||||
await AddSubRuleAsync(subRule, subEntityRule.SubId); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected async virtual Task AddToInjectRuleAsync(RuleGroup group, Guid ruleId) |
|
||||
{ |
|
||||
var entityRule = await RuleRepository.FindAsync(ruleId); |
|
||||
if (entityRule == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
group.WithInjectRule(entityRule.Name); |
|
||||
foreach (var injectRule in entityRule.InjectRules) |
|
||||
{ |
|
||||
await AddToInjectRuleAsync(group, injectRule.InjectId); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected async virtual Task AddToInjectRuleAsync(Rule rule, Guid ruleId) |
|
||||
{ |
|
||||
var entityRule = await RuleRepository.FindAsync(ruleId); |
|
||||
if (entityRule == null) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
var injectRule = ObjectMapper.Map<EntityRule, Rule>(entityRule); |
|
||||
rule.CreateChildren(injectRule); |
|
||||
rule.InjectRule(entityRule.Name); |
|
||||
foreach (var injectSubRule in entityRule.InjectRules) |
|
||||
{ |
|
||||
await AddToInjectRuleAsync(injectRule, injectSubRule.InjectId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,103 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Collections.ObjectModel; |
|
||||
using System.Linq; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleGroup : FullAuditedAggregateRoot<Guid>, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
public virtual string Name { get; protected set; } |
|
||||
public virtual string DisplayName { get; protected set; } |
|
||||
public virtual string EntityFullTypeName { get; protected set; } |
|
||||
public virtual ICollection<EntityRuleInGroup> Rules { get; protected set; } |
|
||||
public virtual ICollection<EntityRuleInject> InjectRules { get; protected set; } |
|
||||
protected EntityRuleGroup() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public EntityRuleGroup( |
|
||||
[NotNull] Guid id, |
|
||||
[NotNull] string name, |
|
||||
[NotNull] string entiyFullTypeName, |
|
||||
[CanBeNull] string displayName, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(id, nameof(id)); |
|
||||
Check.NotNullOrWhiteSpace(name, nameof(name), EntityRuleGroupConsts.MaxNameLength); |
|
||||
Check.NotNullOrWhiteSpace(entiyFullTypeName, nameof(entiyFullTypeName), EntityRuleGroupConsts.MaxEntiyFullTypeNameLength); |
|
||||
|
|
||||
Id = id; |
|
||||
Name = name; |
|
||||
DisplayName = displayName; |
|
||||
TenantId = tenantId; |
|
||||
|
|
||||
Rules = new Collection<EntityRuleInGroup>(); |
|
||||
InjectRules = new Collection<EntityRuleInject>(); |
|
||||
ExtraProperties = new Dictionary<string, object>(); |
|
||||
} |
|
||||
|
|
||||
public virtual void AddInjectRule([NotNull] EntityRule rule) |
|
||||
{ |
|
||||
Check.NotNull(rule, nameof(rule)); |
|
||||
if (IsInjectRule(rule.Id)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
InjectRules.Add(new EntityRuleInject(rule.Id, Id, TenantId)); |
|
||||
} |
|
||||
|
|
||||
public virtual void RemoveInjectRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
if (IsInjectRule(ruleId)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
InjectRules.RemoveAll(rule => rule.RuleId == ruleId); |
|
||||
} |
|
||||
|
|
||||
public virtual bool IsInjectRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
return InjectRules.Any(rule => rule.RuleId == ruleId); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public virtual void AddRule([NotNull] EntityRule rule) |
|
||||
{ |
|
||||
Check.NotNull(rule, nameof(rule)); |
|
||||
|
|
||||
if (IsInRule(rule.Id)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
Rules.Add(new EntityRuleInGroup(rule.Id, Id, TenantId)); |
|
||||
} |
|
||||
|
|
||||
public virtual void RemoveRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
if (!IsInRule(ruleId)) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
Rules.RemoveAll(r => r.RuleId == ruleId); |
|
||||
} |
|
||||
|
|
||||
public virtual bool IsInRule([NotNull] Guid ruleId) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
|
|
||||
return Rules.Any(r => r.RuleId == ruleId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,35 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Domain.Entities; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleInGroup : Entity, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
public virtual Guid RuleId { get; protected set; } |
|
||||
public virtual Guid GroupId { get; protected set; } |
|
||||
protected EntityRuleInGroup() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public EntityRuleInGroup( |
|
||||
[NotNull] Guid ruleId, |
|
||||
[NotNull] Guid groupId, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
Check.NotNull(groupId, nameof(groupId)); |
|
||||
|
|
||||
RuleId = ruleId; |
|
||||
GroupId = groupId; |
|
||||
TenantId = tenantId; |
|
||||
} |
|
||||
public override object[] GetKeys() |
|
||||
{ |
|
||||
return new object[] { RuleId, GroupId }; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,39 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Domain.Entities; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleInject : Entity, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 规则标识
|
|
||||
/// </summary>
|
|
||||
public virtual Guid RuleId { get; protected set; } |
|
||||
/// <summary>
|
|
||||
/// 依赖的规则标识
|
|
||||
/// </summary>
|
|
||||
public virtual Guid InjectId { get; protected set; } |
|
||||
|
|
||||
protected EntityRuleInject() { } |
|
||||
public EntityRuleInject( |
|
||||
[NotNull] Guid ruleId, |
|
||||
[NotNull] Guid injectId, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
Check.NotNull(injectId, nameof(injectId)); |
|
||||
|
|
||||
RuleId = ruleId; |
|
||||
InjectId = injectId; |
|
||||
TenantId = tenantId; |
|
||||
} |
|
||||
public override object[] GetKeys() |
|
||||
{ |
|
||||
return new object[] { RuleId , InjectId }; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,44 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.Domain.Entities; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntityRuleParam : Entity<Guid>, IMultiTenant, IHasExtraProperties |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
public virtual Guid RuleId { get; protected set; } |
|
||||
public virtual string Name { get; protected set; } |
|
||||
public virtual string Expression { get; protected set; } |
|
||||
|
|
||||
public virtual Dictionary<string, object> ExtraProperties { get; protected set; } |
|
||||
|
|
||||
protected EntityRuleParam() |
|
||||
{ |
|
||||
} |
|
||||
public EntityRuleParam( |
|
||||
[NotNull] Guid id, |
|
||||
[NotNull] Guid ruleId, |
|
||||
[NotNull] string name, |
|
||||
[NotNull] string expression, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(id, nameof(id)); |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
Check.NotNullOrWhiteSpace(name, nameof(name), EntityRuleParamConsts.MaxNameLength); |
|
||||
Check.NotNullOrWhiteSpace(expression, nameof(expression), EntityRuleParamConsts.MaxExpressionLength); |
|
||||
|
|
||||
Id = id; |
|
||||
RuleId = ruleId; |
|
||||
Name = name; |
|
||||
Expression = expression; |
|
||||
TenantId = tenantId; |
|
||||
|
|
||||
ExtraProperties = new Dictionary<string, object>(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,35 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.Domain.Entities; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class EntitySubRule : Entity, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
public virtual Guid RuleId { get; protected set; } |
|
||||
public virtual Guid SubId { get; protected set; } |
|
||||
protected EntitySubRule() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public EntitySubRule( |
|
||||
[NotNull] Guid ruleId, |
|
||||
[NotNull] Guid subId, |
|
||||
[CanBeNull] Guid? tenantId = null) |
|
||||
{ |
|
||||
Check.NotNull(ruleId, nameof(ruleId)); |
|
||||
Check.NotNull(subId, nameof(subId)); |
|
||||
|
|
||||
RuleId = ruleId; |
|
||||
SubId = subId; |
|
||||
TenantId = tenantId; |
|
||||
} |
|
||||
public override object[] GetKeys() |
|
||||
{ |
|
||||
return new object[] { RuleId, SubId }; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public interface IEntityRuleDataSeeder |
|
||||
{ |
|
||||
Task SeedAsync(EntityRuleInGroup group); |
|
||||
} |
|
||||
} |
|
||||
@ -1,40 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public interface IEntityRuleGroupRepository : IBasicRepository<EntityRuleGroup, Guid> |
|
||||
{ |
|
||||
Task<EntityRuleGroup> GetByNameAsync( |
|
||||
string name, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default |
|
||||
); |
|
||||
Task<List<EntityRuleGroup>> GetListByTypeAsync( |
|
||||
string entityFullTypeName, |
|
||||
string sorting = null, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
|
|
||||
Task<List<EntityRule>> GetRulesAsync( |
|
||||
Guid groupId, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
|
|
||||
|
|
||||
Task<long> GetCountAsync( |
|
||||
string filter = null, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
|
|
||||
Task<List<EntityRuleGroup>> GetListAsync( |
|
||||
string filter = null, |
|
||||
string sorting = null, |
|
||||
int skipCount = 1, |
|
||||
int maxResultCount = 10, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
} |
|
||||
} |
|
||||
@ -1,35 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public interface IEntityRuleRepository : IBasicRepository<EntityRule, Guid> |
|
||||
{ |
|
||||
Task<List<string>> GetInjectRuleNamesAsync( |
|
||||
Guid ruleId, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default |
|
||||
); |
|
||||
|
|
||||
Task<List<EntityRule>> GetInjectRulesAsync( |
|
||||
Guid ruleId, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default |
|
||||
); |
|
||||
|
|
||||
Task<long> GetCountAsync( |
|
||||
string filter = null, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
|
|
||||
Task<List<EntityRule>> GetListAsync( |
|
||||
string filter = null, |
|
||||
string sorting = null, |
|
||||
int skipCount = 1, |
|
||||
int maxResultCount = 10, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default); |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Data; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public static class RulesManagementDbProperties |
|
||||
{ |
|
||||
public static string DbTablePrefix { get; set; } = "App"; |
|
||||
|
|
||||
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
|
||||
|
|
||||
public const string ConnectionStringName = "AppRulesManagement"; |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
using AutoMapper; |
|
||||
using LINGYUN.Abp.Rules; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement |
|
||||
{ |
|
||||
public class RulesManagementMapperProfile : Profile |
|
||||
{ |
|
||||
public RulesManagementMapperProfile() |
|
||||
{ |
|
||||
CreateMap<EntityRuleParam, RuleParam>(); |
|
||||
CreateMap<EntityRule, Rule>() |
|
||||
.ForMember(rule => rule.InjectRules, map => map.Ignore()) |
|
||||
.ForMember(rule => rule.Rules, map => map.Ignore()); |
|
||||
CreateMap<EntityRuleGroup, RuleGroup>() |
|
||||
.ForMember(rule => rule.InjectRules, map => map.Ignore()) |
|
||||
.ForMember(rule => rule.Rules, map => map.Ignore()); |
|
||||
|
|
||||
CreateMap<EntityRule, EntityRuleEto>(); |
|
||||
CreateMap<EntityRuleGroup, EntityRuleGroupEto>(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,21 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpRulesManagementDomainModule), |
|
||||
typeof(AbpEntityFrameworkCoreModule))] |
|
||||
public class AbpRulesManagementEntityFrameworkCoreModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAbpDbContext<RulesManagementDbContext>(options => |
|
||||
{ |
|
||||
options.AddRepository<EntityRule, EfCoreEntityRuleRepository>(); |
|
||||
options.AddRepository<EntityRuleInGroup, EfCoreEntityRuleGroupRepository>(); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,98 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Linq.Dynamic.Core; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
public class EfCoreEntityRuleGroupRepository : EfCoreRepository<IRulesManagementDbContext, EntityRuleGroup, Guid>, IEntityRuleGroupRepository |
|
||||
{ |
|
||||
public EfCoreEntityRuleGroupRepository( |
|
||||
IDbContextProvider<IRulesManagementDbContext> dbContextProvider) |
|
||||
: base(dbContextProvider) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<EntityRuleGroup> GetByNameAsync( |
|
||||
string name, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await this |
|
||||
.Where(ug => ug.Name.Equals(name)) |
|
||||
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<List<EntityRule>> GetRulesAsync( |
|
||||
Guid groupId, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
var query = from ruleGroup in DbContext.Set<EntityRuleInGroup>() |
|
||||
join rule in DbContext.EntityRules.IncludeDetails(includeDetails) on ruleGroup.RuleId equals rule.Id |
|
||||
where ruleGroup.GroupId == groupId |
|
||||
select rule; |
|
||||
|
|
||||
return await query.ToListAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<long> GetCountAsync( |
|
||||
string filter = null, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await this.WhereIf( |
|
||||
!filter.IsNullOrWhiteSpace(), |
|
||||
rg => |
|
||||
rg.Name.Contains(filter) || |
|
||||
rg.DisplayName.Contains(filter) || |
|
||||
rg.EntityFullTypeName.Contains(filter) |
|
||||
) |
|
||||
.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<List<EntityRuleGroup>> GetListByTypeAsync( |
|
||||
string entityFullTypeName, |
|
||||
string sorting = null, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await DbSet |
|
||||
.IncludeDetails(includeDetails) |
|
||||
.Where(ug => ug.EntityFullTypeName.Equals(entityFullTypeName)) |
|
||||
.OrderBy(sorting ?? nameof(EntityRuleGroup.CreationTime)) |
|
||||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<List<EntityRuleGroup>> GetListAsync( |
|
||||
string filter = null, |
|
||||
string sorting = null, |
|
||||
int skipCount = 1, |
|
||||
int maxResultCount = 10, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await DbSet |
|
||||
.IncludeDetails(includeDetails) |
|
||||
.WhereIf( |
|
||||
!filter.IsNullOrWhiteSpace(), |
|
||||
rg => |
|
||||
rg.Name.Contains(filter) || |
|
||||
rg.DisplayName.Contains(filter) || |
|
||||
rg.EntityFullTypeName.Contains(filter) |
|
||||
) |
|
||||
.OrderBy(sorting ?? nameof(EntityRuleGroup.CreationTime)) |
|
||||
.PageBy(skipCount, maxResultCount) |
|
||||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public override IQueryable<EntityRuleGroup> WithDetails() |
|
||||
{ |
|
||||
return GetQueryable().IncludeDetails(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,76 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Linq.Dynamic.Core; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
public class EfCoreEntityRuleRepository : EfCoreRepository<IRulesManagementDbContext, EntityRule, Guid>, IEntityRuleRepository |
|
||||
{ |
|
||||
public EfCoreEntityRuleRepository( |
|
||||
IDbContextProvider<IRulesManagementDbContext> dbContextProvider) |
|
||||
: base(dbContextProvider) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<List<EntityRule>> GetInjectRulesAsync( |
|
||||
Guid ruleId, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default |
|
||||
) |
|
||||
{ |
|
||||
var query = from injectRule in DbContext.Set<EntityRuleInject>() |
|
||||
join rule in DbContext.EntityRules.IncludeDetails(includeDetails) on injectRule.InjectId equals rule.Id |
|
||||
where injectRule.RuleId == ruleId |
|
||||
select rule; |
|
||||
|
|
||||
return await query.ToListAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<long> GetCountAsync( |
|
||||
string filter = null, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await this |
|
||||
.WhereIf( |
|
||||
!filter.IsNullOrWhiteSpace(), |
|
||||
rg => |
|
||||
rg.Name.Contains(filter) || |
|
||||
rg.DisplayName.Contains(filter) || |
|
||||
rg.Operator.Contains(filter) |
|
||||
) |
|
||||
.LongCountAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public async virtual Task<List<EntityRule>> GetListAsync( |
|
||||
string filter = null, |
|
||||
string sorting = null, |
|
||||
int skipCount = 1, |
|
||||
int maxResultCount = 10, |
|
||||
bool includeDetails = false, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
{ |
|
||||
return await this |
|
||||
.WhereIf( |
|
||||
!filter.IsNullOrWhiteSpace(), |
|
||||
rg => |
|
||||
rg.Name.Contains(filter) || |
|
||||
rg.DisplayName.Contains(filter) || |
|
||||
rg.Operator.Contains(filter) |
|
||||
) |
|
||||
.OrderBy(sorting ?? nameof(EntityRule.CreationTime)) |
|
||||
.PageBy(skipCount, maxResultCount) |
|
||||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|
||||
} |
|
||||
|
|
||||
public override IQueryable<EntityRule> WithDetails() |
|
||||
{ |
|
||||
return GetQueryable().IncludeDetails(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
[ConnectionStringName(RulesManagementDbProperties.ConnectionStringName)] |
|
||||
public interface IRulesManagementDbContext : IEfCoreDbContext |
|
||||
{ |
|
||||
DbSet<EntityRule> EntityRules { get; set; } |
|
||||
DbSet<EntityRuleGroup> EntityRuleGroups { get; set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,25 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
[ConnectionStringName(RulesManagementDbProperties.ConnectionStringName)] |
|
||||
public class RulesManagementDbContext : AbpDbContext<RulesManagementDbContext>, IRulesManagementDbContext |
|
||||
{ |
|
||||
public DbSet<EntityRule> EntityRules { get; set; } |
|
||||
public DbSet<EntityRuleGroup> EntityRuleGroups { get; set; } |
|
||||
|
|
||||
public RulesManagementDbContext( |
|
||||
DbContextOptions<RulesManagementDbContext> options) : base(options) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
protected override void OnModelCreating(ModelBuilder builder) |
|
||||
{ |
|
||||
base.OnModelCreating(builder); |
|
||||
|
|
||||
builder.ConfigureRulesManagement(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,81 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using System; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
public static class RulesManagementDbContextModelBuilderExtensions |
|
||||
{ |
|
||||
public static void ConfigureRulesManagement( |
|
||||
[NotNull] this ModelBuilder builder, |
|
||||
[CanBeNull] Action<RulesManagementModelBuilderConfigurationOptions> optionsAction = null) |
|
||||
{ |
|
||||
Check.NotNull(builder, nameof(builder)); |
|
||||
|
|
||||
var options = new RulesManagementModelBuilderConfigurationOptions( |
|
||||
RulesManagementDbProperties.DbTablePrefix, |
|
||||
RulesManagementDbProperties.DbSchema |
|
||||
); |
|
||||
|
|
||||
optionsAction?.Invoke(options); |
|
||||
|
|
||||
builder.Entity<EntityRuleParam>(b => |
|
||||
{ |
|
||||
b.ToTable(options.TablePrefix + "EntityRuleParams", options.Schema); |
|
||||
|
|
||||
b.ConfigureMultiTenant(); |
|
||||
b.ConfigureExtraProperties(); |
|
||||
|
|
||||
b.Property(x => x.Id).ValueGeneratedNever(); |
|
||||
|
|
||||
b.Property(rp => rp.Name).HasMaxLength(EntityRuleParamConsts.MaxNameLength).IsRequired(); |
|
||||
b.Property(rp => rp.Expression).HasMaxLength(EntityRuleParamConsts.MaxExpressionLength).IsRequired(); |
|
||||
|
|
||||
b.HasIndex(rp => rp.Name); |
|
||||
}); |
|
||||
|
|
||||
builder.Entity<EntityRule>(b => |
|
||||
{ |
|
||||
b.ToTable(options.TablePrefix + "EntityRules", options.Schema); |
|
||||
|
|
||||
b.ConfigureByConvention(); |
|
||||
|
|
||||
b.Property(x => x.Id).ValueGeneratedNever(); |
|
||||
|
|
||||
b.Property(r => r.Name).HasMaxLength(EntityRuleConsts.MaxNameLength).IsRequired(); |
|
||||
b.Property(r => r.Expression).HasMaxLength(EntityRuleConsts.MaxExpressionLength).IsRequired(); |
|
||||
|
|
||||
b.Property(r => r.Operator).HasMaxLength(EntityRuleConsts.MaxOperatorLength); |
|
||||
b.Property(r => r.DisplayName).HasMaxLength(EntityRuleConsts.MaxDisplayNameLength); |
|
||||
b.Property(r => r.ErrorMessage).HasMaxLength(EntityRuleConsts.MaxErrorMessageLength); |
|
||||
|
|
||||
b.HasMany(r => r.SubRules).WithOne().HasForeignKey(r => r.RuleId).IsRequired(); |
|
||||
b.HasMany(r => r.InjectRules).WithOne().HasForeignKey(r => r.InjectId).IsRequired(); |
|
||||
b.HasMany(r => r.Params).WithOne().HasForeignKey(r => r.RuleId).IsRequired(); |
|
||||
|
|
||||
b.HasIndex(r => r.Name); |
|
||||
}); |
|
||||
|
|
||||
builder.Entity<EntityRuleGroup>(b => |
|
||||
{ |
|
||||
b.ToTable(options.TablePrefix + "EntityRuleGroups", options.Schema); |
|
||||
|
|
||||
b.ConfigureByConvention(); |
|
||||
|
|
||||
b.Property(x => x.Id).ValueGeneratedNever(); |
|
||||
|
|
||||
b.Property(rg => rg.Name).HasMaxLength(EntityRuleGroupConsts.MaxNameLength).IsRequired(); |
|
||||
b.Property(rg => rg.EntityFullTypeName).HasMaxLength(EntityRuleGroupConsts.MaxEntiyFullTypeNameLength).IsRequired(); |
|
||||
|
|
||||
b.Property(rg => rg.DisplayName).HasMaxLength(EntityRuleGroupConsts.MaxDisplayNameLength); |
|
||||
|
|
||||
b.HasMany(rg => rg.Rules).WithOne().HasForeignKey(rg => rg.GroupId).IsRequired(); |
|
||||
b.HasMany(rg => rg.InjectRules).WithOne().HasForeignKey(rg => rg.InjectId).IsRequired(); |
|
||||
|
|
||||
b.HasIndex(uc => uc.Name); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using System.Linq; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
public static class RulesManagementEfCoreQueryableExtensions |
|
||||
{ |
|
||||
public static IQueryable<EntityRuleGroup> IncludeDetails(this IQueryable<EntityRuleGroup> queryable, bool include = true) |
|
||||
{ |
|
||||
if (!include) |
|
||||
{ |
|
||||
return queryable; |
|
||||
} |
|
||||
|
|
||||
return queryable |
|
||||
.Include(x => x.Rules) |
|
||||
.Include(x => x.InjectRules); |
|
||||
} |
|
||||
|
|
||||
public static IQueryable<EntityRule> IncludeDetails(this IQueryable<EntityRule> queryable, bool include = true) |
|
||||
{ |
|
||||
if (!include) |
|
||||
{ |
|
||||
return queryable; |
|
||||
} |
|
||||
|
|
||||
return queryable |
|
||||
.Include(x => x.InjectRules) |
|
||||
.Include(x => x.Params); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.EntityFrameworkCore |
|
||||
{ |
|
||||
public class RulesManagementModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions |
|
||||
{ |
|
||||
public RulesManagementModelBuilderConfigurationOptions( |
|
||||
[NotNull] string tablePrefix, |
|
||||
[CanBeNull] string schema) |
|
||||
: base(tablePrefix, schema) |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.HttpApi.Client |
|
||||
{ |
|
||||
public class Class1 |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Http.Client" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,8 +0,0 @@ |
|||||
using System; |
|
||||
|
|
||||
namespace LINGYUN.Abp.RulesManagement.HttpApi |
|
||||
{ |
|
||||
public class Class1 |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<Import Project="..\..\..\common.props" /> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|
||||
<RootNamespace /> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="4.4.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Folder Include="LINGYUN\Abp\RulesManagement\" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,19 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.RulesEngineManagement.Domain.Shared\LINGYUN.Abp.RulesEngineManagement.Domain.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Application; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(RulesEngineManagementDomainSharedModule), |
||||
|
typeof(AbpDddApplicationContractsModule))] |
||||
|
public class RulesEngineManagementApplicationContractsModule : AbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,20 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Application" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.RulesEngineManagement.Application.Contracts\LINGYUN.Abp.RulesEngineManagement.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.RulesEngineManagement.Domain\LINGYUN.Abp.RulesEngineManagement.Domain.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.Application; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(RulesEngineManagementApplicationContractsModule), |
||||
|
typeof(RulesEngineManagementDomainModule), |
||||
|
typeof(AbpDddApplicationModule))] |
||||
|
public class RulesEngineManagementApplicationModule : AbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,16 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Features" Version="$(VoloAbpPackageVersion)" /> |
||||
|
<PackageReference Include="Volo.Abp.Validation" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,5 @@ |
|||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public static class ActionRecordConsts |
||||
|
{ |
||||
|
public static int MaxNameLength { get; set; } = 64; |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public enum ActionType : byte |
||||
|
{ |
||||
|
Success = 0, |
||||
|
Failure = 1, |
||||
|
} |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public static class ParamRecordConsts |
||||
|
{ |
||||
|
public static int MaxNameLength { get; set; } = 64; |
||||
|
public static int MaxExpressionLength { get; set; } = int.MaxValue; |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public static class RuleRecordConsts |
||||
|
{ |
||||
|
public static int MaxNameLength { get; set; } = 64; |
||||
|
public static int MaxOperatorLength { get; set; } = 30; |
||||
|
public static int MaxErrorMessageLength { get; set; } = 255; |
||||
|
public static int MaxInjectWorkflowsLength { get; set; } = (MaxNameLength + 1) * 5; |
||||
|
public static int MaxExpressionLength { get; set; } = int.MaxValue; |
||||
|
public static int MaxSuccessEventLength { get; set; } = 128; |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.Features; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.Validation; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpFeaturesModule), |
||||
|
typeof(AbpValidationModule))] |
||||
|
public class RulesEngineManagementDomainSharedModule : AbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public static class WorkflowRecordConsts |
||||
|
{ |
||||
|
public static int MaxNameLength { get; set; } = 64; |
||||
|
public static int MaxTypeFullNameLength { get; set; } = 255; |
||||
|
public static int MaxInjectWorkflowsLength { get; set; } = (MaxNameLength + 1) * 5; |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,20 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netstandard2.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(VoloAbpPackageVersion)" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\..\rules\LINGYUN.Abp.Rules.RulesEngine\LINGYUN.Abp.Rules.RulesEngine.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.RulesEngineManagement.Domain.Shared\LINGYUN.Abp.RulesEngineManagement.Domain.Shared.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,32 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
|
||||
|
public class ActionRecord : Entity<Guid>, IMultiTenant, IHasExtraProperties |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual string Name { get; protected set; } |
||||
|
public virtual ExtraPropertyDictionary ExtraProperties { get; protected set; } |
||||
|
protected ActionRecord() |
||||
|
{ |
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
public ActionRecord( |
||||
|
Guid id, |
||||
|
string name, |
||||
|
Guid? tenantId = null) |
||||
|
: base(id) |
||||
|
{ |
||||
|
Name = Check.NotNullOrWhiteSpace(name, nameof(name), ActionRecordConsts.MaxNameLength); |
||||
|
|
||||
|
TenantId = tenantId; |
||||
|
|
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public interface IRuleRecordRepository : IRepository<RuleRecord, Guid> |
||||
|
{ |
||||
|
Task<List<RuleRecord>> GetChildrenRulesAsync( |
||||
|
Guid ruleId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
Task<List<ParamRecord>> GetParamsAsync( |
||||
|
Guid ruleId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
Task<ActionRecord> GetSuccessActionAsync( |
||||
|
Guid ruleId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
Task<ActionRecord> GetFailureActionAsync( |
||||
|
Guid ruleId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public interface IWorkflowRecordRepository : IRepository<WorkflowRecord, Guid> |
||||
|
{ |
||||
|
Task<WorkflowRecord> FindByNameAsync( |
||||
|
string name, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<WorkflowRecord>> GetListAsync( |
||||
|
string typeFullName, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<List<ParamRecord>> GetParamsAsync( |
||||
|
Guid workflowId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public class ParamRecord : Entity<Guid>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual string Name { get; protected set; } |
||||
|
public virtual string Expression { get; protected set; } |
||||
|
protected ParamRecord() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ParamRecord(Guid id, string name, string expression, Guid? tenantId = null) |
||||
|
: base(id) |
||||
|
{ |
||||
|
Name = Check.NotNullOrWhiteSpace(name, nameof(name), ParamRecordConsts.MaxNameLength); |
||||
|
Expression = Check.NotNullOrWhiteSpace(expression, nameof(expression), ParamRecordConsts.MaxExpressionLength); |
||||
|
TenantId = tenantId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public class RuleActionRecord : Entity<int>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual Guid ActionId { get; protected set; } |
||||
|
public virtual Guid RuleId { get; protected set; } |
||||
|
public virtual ActionType ActionType { get; protected set; } |
||||
|
protected RuleActionRecord() { } |
||||
|
public RuleActionRecord( |
||||
|
Guid ruleId, |
||||
|
Guid actionId, |
||||
|
ActionType actionType, |
||||
|
Guid? tenantId = null) |
||||
|
{ |
||||
|
RuleId = ruleId; |
||||
|
ActionId = actionId; |
||||
|
ActionType = actionType; |
||||
|
TenantId = tenantId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public class RuleParamRecord : Entity<int>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual Guid RuleId { get; protected set; } |
||||
|
public virtual Guid ParamId { get; protected set; } |
||||
|
protected RuleParamRecord() { } |
||||
|
public RuleParamRecord(Guid ruleId, Guid paramId, Guid? tenantId = null) |
||||
|
{ |
||||
|
TenantId = tenantId; |
||||
|
RuleId = ruleId; |
||||
|
ParamId = paramId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
using RulesEngine.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Collections.ObjectModel; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public class RuleRecord : AuditedAggregateRoot<Guid>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
public virtual Guid? ParentId { get; protected set; } |
||||
|
public virtual bool Enabled { get; set; } |
||||
|
public virtual string Name { get; protected set; } |
||||
|
public virtual string Operator { get; protected set; } |
||||
|
public virtual string ErrorMessage { get; protected set; } |
||||
|
public virtual RuleExpressionType RuleExpressionType { get; set; } |
||||
|
public virtual string InjectWorkflows { get; set; } |
||||
|
public virtual string Expression { get; protected set; } |
||||
|
public virtual string SuccessEvent { get; set; } |
||||
|
public virtual ICollection<RuleParamRecord> LocalParams { get; protected set; } |
||||
|
public virtual RuleActionRecord OnSuccess { get; protected set; } |
||||
|
public virtual RuleActionRecord OnFailure { get; protected set; } |
||||
|
protected RuleRecord() |
||||
|
{ |
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public RuleRecord( |
||||
|
Guid id, |
||||
|
string name, |
||||
|
string errorMessage, |
||||
|
string expression, |
||||
|
string @operator = null, |
||||
|
Guid? parentId = null, |
||||
|
Guid? tenantId = null) |
||||
|
: base(id) |
||||
|
{ |
||||
|
Name = Check.NotNullOrWhiteSpace(name, nameof(name), RuleRecordConsts.MaxNameLength); |
||||
|
ErrorMessage = Check.NotNullOrWhiteSpace(errorMessage, nameof(errorMessage), RuleRecordConsts.MaxErrorMessageLength); |
||||
|
Expression = Check.NotNullOrWhiteSpace(expression, nameof(expression), RuleRecordConsts.MaxExpressionLength); |
||||
|
|
||||
|
Operator = Check.Length(@operator, nameof(@operator), RuleRecordConsts.MaxOperatorLength); |
||||
|
|
||||
|
ParentId = parentId; |
||||
|
TenantId = tenantId; |
||||
|
|
||||
|
Enabled = true; |
||||
|
RuleExpressionType = RuleExpressionType.LambdaExpression; |
||||
|
|
||||
|
LocalParams = new Collection<RuleParamRecord>(); |
||||
|
|
||||
|
ExtraProperties = new ExtraPropertyDictionary(); |
||||
|
this.SetDefaultsForExtraProperties(); |
||||
|
} |
||||
|
|
||||
|
public void SetSuccessAction(ActionRecord action) |
||||
|
{ |
||||
|
OnSuccess = new RuleActionRecord(Id, action.Id, ActionType.Success, TenantId); |
||||
|
} |
||||
|
|
||||
|
public void SetFailureAction(ActionRecord action) |
||||
|
{ |
||||
|
OnFailure = new RuleActionRecord(Id, action.Id, ActionType.Failure, TenantId); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Data; |
||||
|
|
||||
|
namespace LINGYUN.Abp.RulesEngineManagement; |
||||
|
public static class RulesEngineManagementDbPropertites |
||||
|
{ |
||||
|
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix + "RulesEngine"; |
||||
|
|
||||
|
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
||||
|
|
||||
|
|
||||
|
public const string ConnectionStringName = "RulesEngineManagement"; |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue