public virtual void Run() { IList <string> ignores = _bootrapperConfiguration.IgnorePathPatterns.ToList(); foreach (var ignorePathPattern in IgnorePathPatterns) { ignores.Add(ignorePathPattern); } string basePath = AppDomain.CurrentDomain.BaseDirectory; string rootPath = GetRootPath(basePath); var paths = new List <string> { rootPath }; paths.AddRange(_bootrapperConfiguration.AdditionalLookupPaths.Select(additionalLookupPath => rootPath + "\\" + additionalLookupPath)); var logger = new Log4NetLogger(); logger.Init(GetType()); _recursiveDirectoryCatalog = new SafeRecursiveDirectoryCatalog( logger, paths.ToArray(), _bootrapperConfiguration.MEFAssemblyNamePattern, ignores); BuildContainer(); OnInitialized(); HandleShutdownRequest(); Logger.InfoFormat("MEF container built and initialized ({0} parts)", Container.Catalog.Parts.Count()); }
private void Install() { services.AddTransient <IDbContextFactory, DbContextFactory>(); services.AddTransient <IUnitOfWorkFactory, UnitOfWorkFactory>(); services.AddTransient <IJsonSerializer, JsonSerializer>(); services.AddTransient <IXmlSerializer, XmlSerializer>(); services.AddTransient <IClassMapper, ClassMapper>(); services.AddTransient <ILogger, Log4NetLogger>(); Log4NetLogger.Init(); services.AddTransient <IPaymentService, PaymentService>(); services.AddTransient <BankDomainService>(); services.AddTransient <ProviderDomainService>(); services.AddTransient <IBankBinRepository, BankBinRepository>(); services.AddTransient <IBankProviderRepository, BankProviderRepository>(); services.AddTransient <IProviderRepository, ProviderRepository>(); services.AddTransient <IBankValidation, BankValidation>(); ContractToDomainModelMapping(); DomainToContractModelMapping(); using (PaymentDbContext context = new PaymentDbContext()) { context.Database.Migrate(); } }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Component.For <ILogger>().ImplementedBy <Log4NetLogger>().LifeStyle.Singleton); var logfile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "log4net.config"); Log4NetLogger.Init(logfile); }
public void WhenInitializeLogger_MustHaveCorrectLoggerName() { var logger = new Log4NetLogger(); logger.Init(GetType()); logger.LoggerName.Should().Be( "VP.FF.PT.Common.Infrastructure.UnitTests.LoggerTests"); }
static void Main(string[] args) { var logfile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "log4net.config"); Log4NetLogger.Init(logfile); Log4NetLogger k = new Log4NetLogger(); k.Log("this is a debug log...", LogType.Debug); Console.ReadLine(); }
protected override IEnumerable <Assembly> SelectAssemblies() { _bootrapperConfiguration = new BootrapperConfiguration(); if (DesignTimeHelper.IsInDesignModeStatic) { return(null); } var paths = new List <string>(); // collect all assemblies with catalog and safe it for later use var uri = new Uri(Assembly.GetAssembly(typeof(MefBootstrapper)).CodeBase); string rootPath = GetRootPath(uri.LocalPath); paths.Add(rootPath); foreach (var additionalLookupPath in _bootrapperConfiguration.AdditionalLookupPaths) { paths.Add(rootPath + "\\" + additionalLookupPath); } var logger = new Log4NetLogger(); logger.Init(GetType()); _recursiveDirectoryCatalog = new SafeRecursiveDirectoryCatalog( logger, paths.ToArray(), _bootrapperConfiguration.MEFAssemblyNamePattern, _bootrapperConfiguration.IgnorePathPatterns); IList <Assembly> list = new List <Assembly>(); list.Add(Assembly.GetEntryAssembly()); foreach (string assemblyPath in _recursiveDirectoryCatalog.LoadedAssemblies) { list.Add(Assembly.LoadFrom(assemblyPath)); } return(list); }