forked from nkovacic/Sample-ASP.NET-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSampleCoreModule.cs
More file actions
44 lines (41 loc) · 1.71 KB
/
SampleCoreModule.cs
File metadata and controls
44 lines (41 loc) · 1.71 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
40
41
42
43
44
using Autofac;
using Microsoft.ApplicationInsights;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Sample.Core.Data.Database;
using Sample.Core.Logging;
using Sample.Core.Modules;
using Sample.Core.Web.Formatters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.ExceptionHandling;
namespace Sample.Core
{
public class SampleCoreModule : ILamaCoreModule, ILamaWebApiModule, ILamaWebModule
{
public static JsonSerializerSettings JsonSettings { get; } = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
Converters = new List<JsonConverter> {
new StringEnumConverter { CamelCaseText = true },
new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffzzz" }
},
DateParseHandling = DateParseHandling.DateTimeOffset,
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Formatting = Formatting.None
};
public void Initialize(ContainerBuilder builder)
{
builder.RegisterType<ApplicationInsightsLogger>().As<ILogger>().SingleInstance();
builder.RegisterType<ApplicationInsightsWebApiLogger>().As<IExceptionLogger>().SingleInstance();
builder.RegisterType<MultipartFormFormatter>().SingleInstance();
builder.RegisterType<TelemetryClient>().SingleInstance();
builder.RegisterType<UnitOfWork>().As<IUnitOfWorkAsync>().As<IUnitOfWork>().InstancePerLifetimeScope();
}
public void PostInitialize(ILifetimeScope container) { }
}
}