NRules.Integration.AspNetCore
No description available
Install / Use
/learn @cloudb0x/NRules.Integration.AspNetCoreREADME
NRules.Integration.AspNetCore
An Integration For Nrules for Asp .Net Core for the built in Dependency Injection container.
Getting Started
Adding the integration is as straightforward as calling two extension methods in your Startup.cs class.
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddNRules(AppDomain.CurrentDomain.GetAssemblies()) // Loads Rules from assemblies and Registers NRule with DI Container
.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseNRules(); //Add the configured DI Container as the dependency resolver for Nrules
app.UseHttpsRedirection();
app.UseMvc();
}
Usage
Simply Injecting ISession into your dependency is enough. This Calls the ISessionFactory and creates a new scoped session.
public class SomeService : ISomeService
{
private readonly ISession _session;
public SomeService(ISession session)
{
_session = session;
}
public void DoSomethingWithSession()
{
var fact = "I Am a Fact";
_session.Insert(fact);
_session.Fire();
}
}
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
