/// <summary> /// Default private constructor. /// </summary> private Application() { var catalog = new AggregateCatalog(); // Compose parts catalog.Catalogs.Add(new DirectoryCatalog("Bin")); Container = new CompositionContainer(catalog); Container.ComposeParts(this); // Get the current media provider var assembly = Assembly.Load(Config.MediaProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.MediaProvider.TypeName); if (type != null) { MediaProvider = (IO.IMediaProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("MediaProvider " + Config.MediaProvider.TypeName + " was not found"); } } // Get the current cache provider assembly = Assembly.Load(Config.CacheProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.CacheProvider.TypeName); if (type != null) { CacheProvider = (Cache.ICacheProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("CacheProvider " + Config.CacheProvider.TypeName + " was not found"); } } // Get the current log provider assembly = Assembly.Load(Config.LogProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.LogProvider.TypeName); if (type != null) { LogProvider = (Log.ILogProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("LogProvider " + Config.LogProvider.TypeName + " was not found"); } } RegisterHandlers(); }
/// <summary> /// Default private constructor. /// </summary> private Application() { var catalog = new AggregateCatalog() ; // Compose parts catalog.Catalogs.Add(new DirectoryCatalog("Bin")) ; Container = new CompositionContainer(catalog) ; Container.ComposeParts(this) ; // Get the current media provider var assembly = Assembly.Load(Config.MediaProvider.AssemblyName) ; if (assembly != null) { var type = assembly.GetType(Config.MediaProvider.TypeName) ; if (type != null) MediaProvider = (IO.IMediaProvider)Activator.CreateInstance(type) ; else throw new TypeAccessException("MediaProvider " + Config.MediaProvider.TypeName + " was not found") ; } // Get the current cache provider assembly = Assembly.Load(Config.CacheProvider.AssemblyName) ; if (assembly != null) { var type = assembly.GetType(Config.CacheProvider.TypeName) ; if (type != null) CacheProvider = (Cache.ICacheProvider)Activator.CreateInstance(type) ; else throw new TypeAccessException("CacheProvider " + Config.CacheProvider.TypeName + " was not found") ; } // Get the current log provider assembly = Assembly.Load(Config.LogProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.LogProvider.TypeName); if (type != null) LogProvider = (Log.ILogProvider)Activator.CreateInstance(type); else throw new TypeAccessException("LogProvider " + Config.LogProvider.TypeName + " was not found"); } RegisterHandlers() ; }
public RegisterModel(IUserService service, ISmsService smsService, Cache.ICacheProvider cache) { _service = service; _smsService = smsService; _cache = cache; }
/// <summary> /// Default private constructor. /// </summary> private Application() { var catalog = new AggregateCatalog(); // Compose parts catalog.Catalogs.Add(Config.DisableCatalogSearch ? new DirectoryCatalog("Bin", "Piranha*.dll") : new DirectoryCatalog("Bin")); Container = new CompositionContainer(catalog); Container.ComposeParts(this); // Get the current media provider var assembly = Assembly.Load(Config.MediaProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.MediaProvider.TypeName); if (type != null) { MediaProvider = (IO.IMediaProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("MediaProvider " + Config.MediaProvider.TypeName + " was not found"); } } // Get the current media cache provider assembly = Assembly.Load(Config.MediaCacheProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.MediaCacheProvider.TypeName); if (type != null) { MediaCacheProvider = (IO.IMediaCacheProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("MediaCacheProvider " + Config.MediaCacheProvider.TypeName + " was not found"); } } // Get the current cache provider assembly = Assembly.Load(Config.CacheProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.CacheProvider.TypeName); if (type != null) { CacheProvider = (Cache.ICacheProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("CacheProvider " + Config.CacheProvider.TypeName + " was not found"); } } // Get the current log provider assembly = Assembly.Load(Config.LogProvider.AssemblyName); if (assembly != null) { var type = assembly.GetType(Config.LogProvider.TypeName); if (type != null) { LogProvider = (Log.ILogProvider)Activator.CreateInstance(type); } else { throw new TypeAccessException("LogProvider " + Config.LogProvider.TypeName + " was not found"); } } RegisterHandlers(); // Configure AutoMapper Mapper.CreateMap <Models.Sitemap, Models.Sitemap>() .ForMember(s => s.Pages, o => o.Ignore()); // Assert configuration Mapper.AssertConfigurationIsValid(); }