You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
976 B
31 lines
976 B
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Volo.Abp.Modularity;
|
|
using NRule = NRules.Fluent.Dsl.Rule;
|
|
|
|
namespace LINGYUN.Abp.Rules.NRules
|
|
{
|
|
[DependsOn(
|
|
typeof(AbpRulesModule)
|
|
)]
|
|
public class AbpNRulesModule : AbpModule
|
|
{
|
|
private readonly AbpNRulesOptions options = new AbpNRulesOptions();
|
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
context.Services.AddObjectAccessor(options);
|
|
context.Services.OnRegistred(ctx =>
|
|
{
|
|
if (ctx.ImplementationType.IsAssignableTo(typeof(NRule)))
|
|
{
|
|
options.Rules.AddIfNotContains(ctx.ImplementationType);
|
|
}
|
|
});
|
|
}
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
context.Services.AddNRules(options);
|
|
}
|
|
}
|
|
}
|
|
|