-
-
Notifications
You must be signed in to change notification settings - Fork 528
Expand file tree
/
Copy pathStartup.cs
More file actions
40 lines (31 loc) · 1.03 KB
/
Startup.cs
File metadata and controls
40 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Data;
using Marten;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Weasel.Postgresql;
namespace AspNetCoreWithMarten.Samples.LightweightSessions;
public class Startup
{
public Startup(IConfiguration configuration, IHostEnvironment hosting)
{
Configuration = configuration;
Hosting = hosting;
}
public IConfiguration Configuration { get; }
public IHostEnvironment Hosting { get; }
public void ConfigureServices(IServiceCollection services)
{
#region sample_AddMartenWithLightweightSessions
var connectionString = Configuration.GetConnectionString("postgres");
services.AddMarten(opts =>
{
opts.Connection(connectionString);
})
// Chained helper to replace the built in
// session factory behavior
.UseLightweightSessions();
#endregion
}
// And other methods we don't care about here...
}