Created
August 27, 2019 18:05
-
-
Save rofr/455506bb30eea3e0d2bfc53d06902249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyRegistry : Registry | |
{ | |
public PosifonIntegrationServicesRegistry() | |
{ | |
For<DateTimeProvider>().Use(() => DateTimeProvider.Default); | |
For<DeviceMessageHandler>().Use<DeviceMessageHandler>(); | |
var connectionString = ConfigurationManager | |
.ConnectionStrings["redacted"] | |
.ConnectionString; | |
For<IMyDataContext>() | |
.Use<MyDataContext>() | |
.Ctor<string>("connectionstring") | |
.Is(connectionString); | |
For<MyDataContext>() | |
.Use<MyDataContext>() | |
.Ctor<string>("connectionstring") | |
.Is(connectionString); | |
Scan(scanner => | |
{ | |
scanner.TheCallingAssembly(); | |
scanner.AssemblyContainingType<MyDataContext>(); | |
scanner.AssemblyContainingType<UserService>(); | |
scanner.WithDefaultConventions(); | |
}); | |
var metrics = AppMetrics | |
.CreateDefaultBuilder() | |
.Configuration.Configure(options => options.AddServerTag()) | |
.OutputMetrics.AsJson() | |
.Build(); | |
For<IMetrics>() | |
.Use(metrics); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment