52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
using SampleWorkflowWeb.Services;
|
|
using Caspian.WorkflowFramework;
|
|
using MongoLogger;
|
|
using MongoLogger.Models;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews();
|
|
|
|
//Workflow
|
|
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
|
builder.AddWorkflowFramework(connectionString);
|
|
|
|
builder.Services.AddMongoLogger<LogModel>(builder.Configuration);
|
|
|
|
builder.Services.AddSingleton<ICardService, CardService>();
|
|
|
|
builder.Services.AddSession(options =>
|
|
{
|
|
options.IdleTimeout = TimeSpan.FromMinutes(30); // Adjust as needed
|
|
options.Cookie.HttpOnly = true;
|
|
options.Cookie.IsEssential = true;
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
app.UseMongoLogger<LogModel>();
|
|
|
|
//Workflow
|
|
app.UseWorkflowFramework();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
}
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapStaticAssets();
|
|
|
|
app.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}")
|
|
.WithStaticAssets();
|
|
|
|
app.UseSession();
|
|
|
|
app.Run();
|