Adds code
This commit is contained in:
commit
269bf50c78
33 changed files with 1489 additions and 0 deletions
22
Core/ModuleRegistry/DbPostgreSqlModule.cs
Normal file
22
Core/ModuleRegistry/DbPostgreSqlModule.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Autofac;
|
||||
using Npgsql;
|
||||
using System.Data;
|
||||
namespace Core.ModuleRegistry
|
||||
{
|
||||
public class DbPostgreSqlModule : Module
|
||||
{
|
||||
public string ConnectionString { get; set; }
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
|
||||
builder.Register(c =>
|
||||
{
|
||||
IDbConnection connection = new NpgsqlConnection(ConnectionString);
|
||||
return connection;
|
||||
})
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
//builder.RegisterType<IDbConnection>().As<IDbConnection>().InstancePerLifetimeScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Core/ModuleRegistry/TelemetryModule.cs
Normal file
31
Core/ModuleRegistry/TelemetryModule.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Autofac;
|
||||
|
||||
namespace Core.ModuleRegistry
|
||||
{
|
||||
public class TelemetryModule : Module
|
||||
{
|
||||
public TelemetryConfig TelemetryConfig { get; set; }
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
if (TelemetryConfig == null)
|
||||
throw new Exceptions.ConfigurationException("TelemetryConfig is missing");
|
||||
|
||||
var tmc = Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.CreateDefault();
|
||||
tmc.ConnectionString = TelemetryConfig.ConnectionString;
|
||||
tmc.TelemetryChannel.DeveloperMode = true;
|
||||
|
||||
//var r = new Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder(tmc);
|
||||
//r.Use(next => new Domain.EventTelemetryEnrichers.EnrichWithMetaTelemetry(next));
|
||||
//r.Build();
|
||||
|
||||
builder.RegisterInstance(tmc);
|
||||
builder.RegisterType<Microsoft.ApplicationInsights.TelemetryClient>().InstancePerLifetimeScope();
|
||||
}
|
||||
}
|
||||
|
||||
public class TelemetryConfig
|
||||
{
|
||||
public string InstrumentationKey { get; set; }
|
||||
public string ConnectionString { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue