-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStartup.cs
32 lines (29 loc) · 1.2 KB
/
Startup.cs
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
using DnnReactModule.Data;
using DnnReactModule.Data.IRepositories;
using DnnReactModule.Data.Repositories;
using DnnReactModule.Services;
using DotNetNuke.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System.Web.Http;
namespace DnnReactModule
{
/// <summary>
/// Class implementing IDnnStartup interface for configuring services in a DNN module startup.
/// </summary>
public class Startup : IDnnStartup
{
public void ConfigureServices(IServiceCollection services)
{
#region Config DbContext
var config = GlobalConfiguration.Configuration;
config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
//config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
services.AddScoped<ModuleDbContext, ModuleDbContext>();
#endregion
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
services.AddScoped<IRepositoryManager, RepositoryManager>();
services.AddScoped<IServiceManager, ServiceManager>();
}
}
}