This file contains hidden or 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
| namespace HelloSvc.SettingsProviders | |
| { | |
| public interface IEventLogConfigProvider | |
| { | |
| String LogName { get; } | |
| String SourceName { get; } | |
| } | |
| public class ConstantEventLogProvider : IEventLogConfigProvider | |
| { |
This file contains hidden or 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
| namespace HelloSvc.Services | |
| { | |
| using Config; | |
| internal class GreetService : ServiceBase | |
| { | |
| protected virtual IGreeter Greeter | |
| { | |
| get; |
This file contains hidden or 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
| internal class GreetService : ServiceBase | |
| { | |
| protected virtual IGreeter Greeter | |
| { | |
| get; | |
| private set; | |
| } | |
| protected virtual ILogger Logger | |
| { |
This file contains hidden or 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 BootstrapIoC | |
| { | |
| public BootstrapIoC () | |
| { | |
| } | |
| public IContainer Build() | |
| { | |
| var builder = new ContainerBuilder(); | |
This file contains hidden or 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
| builder | |
| .RegisterType<Cache>() | |
| .As<ICache>() | |
| .WithMetadata("CacheType", ECacheType.Thumb) | |
| .InstancePerLifetimeScope(); | |
| builder | |
| .RegisterType<Cache>() | |
| .As<ICache>() | |
| .WithMetadata("CacheType", ECacheType.Image) |
This file contains hidden or 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
| builder | |
| .RegisterType<Cache>() | |
| .Keyed<ECacheType>(ECacheType.Thumb) | |
| .As<ICache>() | |
| .InstancePerLifetimeScope(); | |
| builder | |
| .RegisterType<Cache>() | |
| .Keyed<ECacheType>(ECacheType.Image) | |
| .As<ICache>() |
This file contains hidden or 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
| builder | |
| .RegisterType<Config.ServiceNameProvider>() | |
| .As<Config.IServiceNameProvider>() | |
| .InstancePerLifetimeScope(); |
This file contains hidden or 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 GreetService(IServiceNameProvider serviceNameProvider) | |
| { | |
| serviceNameProvider.ThrowIfNull("serviceNameProvider"); | |
| ServiceName = | |
| serviceNameProvider.ServiceName | |
| .ThrowIfNullOrEmpty("serviceNameProvider.ServiceName"); | |
| CanStop = true; | |
| AutoLog = false; |
This file contains hidden or 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
| namespace HelloSvc.Config | |
| { | |
| internal interface IServiceNameProvider | |
| { | |
| String ServiceName { get; } | |
| } | |
| } |
This file contains hidden or 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
| using System.ServiceProcess; | |
| using Autofac; | |
| namespace HelloSvc | |
| { | |
| internal class ServiceBootstrapper | |
| { | |
| public IContainer Build() | |
| { |