/// <summary> /// Registers the automapper profiles. /// </summary> /// <param name="registerer">The container.</param> /// <param name="assembly">The assembly.</param> /// <returns></returns> public static IIocRegisterer RegisterAutomapperProfilesFromAssembly(this IIocRegisterer registerer, Assembly assembly) { var mapperConfigurationInterfaceType = typeof(IMapperConfiguration <>); var mapperInterfaceType = typeof(IMapper <>); var mapperConfigurationType = typeof(MapperConfiguration <>); var mapperType = typeof(Mapper <>); var reflectionService = registerer.Resolver.Resolve <IReflectionService>(); var profileTypes = reflectionService.GetTypesFromBaseTypeInAssembly <Profile>(assembly); foreach (var profileType in profileTypes) { if (!registerer.HasComponent(profileType)) { registerer.RegisterScoped(profileType, profileType); } var mapperConfigurationInterface = mapperConfigurationInterfaceType.MakeGenericType(profileType); if (!registerer.HasComponent(mapperConfigurationInterface)) { var mapperConfiguration = mapperConfigurationType.MakeGenericType(profileType); registerer.RegisterSingleton(mapperConfigurationInterface, mapperConfiguration); } var mapperInterface = mapperInterfaceType.MakeGenericType(profileType); if (!registerer.HasComponent(mapperInterface)) { var mapper = mapperType.MakeGenericType(profileType); registerer.RegisterScoped(mapperInterface, mapper); } } return(registerer); }
/// <summary> /// Adds the configuration instance to windsor container. /// </summary> /// <param name="container">The container.</param> /// <returns>The configuration instance</returns> public static IIocRegisterer AddAutomapper(this IIocRegisterer container) { container.RegisterSingleton(typeof(IMapperConfiguration <>), typeof(MapperConfiguration <>)); container.RegisterTransient(typeof(IMapper <>), typeof(Mapper <>)); return(container); }
/// <summary>Configures the turkuaz logging.</summary> /// <param name="registerer">The application.</param> /// <param name="path">The path.</param> /// <param name="configFileName">Name of the configuration file.</param> /// <param name="repositoryAssembly">The repository assembly.</param> /// <returns></returns> public void Configure(IIocRegisterer registerer) { //application.Container.RegisterTurkuazLogging(); //return application; //this.InternalApplication = application; RegisterYuyaLogging(registerer); }
/// <summary> /// Registers the turkuaz logging. /// </summary> /// <param name="container">The container.</param> public void RegisterYuyaLogging(IIocRegisterer registerer) { this.InternalApplication = registerer; registerer.RegisterInstance <Microsoft.Extensions.Logging.ILoggerFactory>(_loggerFactory); registerer.AddFacility <LoggingFacility>(); }
/// <summary> /// Registers the automapper profiles. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="container">The container.</param> /// <returns></returns> public static IIocRegisterer RegisterAutomapperProfilesFrom <T>(this IIocRegisterer container) { return(RegisterAutomapperProfilesFromAssembly(container, typeof(T).Assembly)); }