Exemple #1
0
        /// <summary>
        /// Configures the security.
        /// </summary>
        /// <param name="appContainer">The app container.</param>
        protected virtual void ConfigureSecurity(IContainer appContainer)
        {
            appContainer.Configure(c => c.For <ICurrentUserPermissionService>().Use <CurrentUserPermissionService>());
            var accessCtrlMgr         = appContainer.GetInstance <IAccessControlManager> ();
            var permissionDescriptors = appContainer.GetAllInstances <IPermissionDescriptor> ();

            accessCtrlMgr.RegisterPermissionDescriptor(permissionDescriptors.ToArray());
        }
Exemple #2
0
        /// <summary>
        /// Runs the bootstrapper tasks.
        /// </summary>
        /// <param name="container">The container.</param>
        protected virtual void RunBootstrapperTasks(IContainer container)
        {
            var tasks = container.GetAllInstances <IBootstrapperTask> ();

            foreach (var bootstrapperTask in tasks)
            {
                bootstrapperTask.Execute();
            }
        }
Exemple #3
0
        /// <summary>
        /// Calls the service registries.
        /// </summary>
        /// <param name="container">The container.</param>
        protected virtual void CallServiceRegistries(IContainer container)
        {
            var serviceRegistries = container.GetAllInstances <IServiceRegistry> ();

            foreach (var serviceRegistry in serviceRegistries)
            {
                var serviceRegistryName = serviceRegistry.GetType().ToString();
                Logger.Debug("ServiceRegistries: {0}", serviceRegistryName);
                serviceRegistry.RegisterServices();
            }
        }
Exemple #4
0
        /// <summary>
        ///     Configures the security.
        /// </summary>
        /// <param name="appContainer">The app container.</param>
        protected virtual void ConfigureSecurity(IContainer appContainer)
        {
            appContainer.Configure(c => c.For <ICurrentUserPermissionService>().Use <CurrentUserPermissionService>());
            appContainer.Configure(c => c.For <ICurrentClaimsPrincipalService>().Use <CurrentClaimsPrincipleService>());
            appContainer.Configure(c => c.For <IAccessControlManager>().Singleton().Use <ProCenterAccessControlManager>());
            appContainer.Configure(c => c.For <IProvidePermissions>().Use(conf => conf.GetInstance <IAccessControlManager>() as IProvidePermissions));
            var accessCtrlMgr         = appContainer.GetInstance <IAccessControlManager>();
            var permissionDescriptors = appContainer.GetAllInstances <IPermissionDescriptor>();

            accessCtrlMgr.RegisterPermissionDescriptor(permissionDescriptors.ToArray());
        }
Exemple #5
0
        private void CallKnownTypeProviders(IContainer container)
        {
            Logger.Info("Running Known Type Providers");
            var knownTypeProviders = container.GetAllInstances <IKnownTypeProvider>();

            foreach (var knownTypeProvider in knownTypeProviders)
            {
                var knownTypeProviderName = knownTypeProvider.GetType().ToString();
                Logger.Debug("KnownTypeProviders: {0}", knownTypeProviderName);
                knownTypeProvider.RegisterTypes();
            }
        }
Exemple #6
0
        /// <summary>
        /// Configures the auto mapper.
        /// </summary>
        /// <param name="appContainer">The app container.</param>
        protected virtual void ConfigureAutoMapper(IContainer appContainer)
        {
            var originalMapperFunction = MapperRegistry.AllMappers;

            MapperRegistry.AllMappers = () =>
            {
                var mappers       = (originalMapperFunction.Invoke() as IObjectMapper[]).ToList();
                var objectMappers = appContainer.GetAllInstances <IObjectMapper> ();
                mappers.AddRange(objectMappers);
                return(mappers.ToArray());
            };
        }
 IEnumerable <object> Common.IContainer.BuildAll(Type typeToBuild)
 {
     return(container.GetAllInstances(typeToBuild).Cast <object>());
 }
Exemple #8
0
 public IEnumerable <object> GetServices(Type serviceType)
 {
     return(_container.GetAllInstances(serviceType).Cast <object>());
 }
Exemple #9
0
 public IEnumerable <object> GetInstances(Type type)
 {
     return(_container.GetAllInstances(type).Cast <object>());
 }
Exemple #10
0
 private void CallKnownTypeProviders(IContainer container)
 {
     Logger.Info("Running Known Type Providers");
     var knownTypeProviders = container.GetAllInstances<IKnownTypeProvider>();
     foreach (var knownTypeProvider in knownTypeProviders)
     {
         var knownTypeProviderName = knownTypeProvider.GetType().ToString();
         Logger.Debug("KnownTypeProviders: {0}", knownTypeProviderName);
         knownTypeProvider.RegisterTypes();
     }
 }
Exemple #11
0
 /// <summary>
 /// Runs the bootstrapper tasks.
 /// </summary>
 /// <param name="container">The container.</param>
 protected virtual void RunBootstrapperTasks(IContainer container)
 {
     var tasks = container.GetAllInstances<IBootstrapperTask> ();
     foreach ( var bootstrapperTask in tasks )
     {
         bootstrapperTask.Execute ();
     }
 }
Exemple #12
0
 /// <summary>
 /// Configures the security.
 /// </summary>
 /// <param name="appContainer">The app container.</param>
 protected virtual void ConfigureSecurity( IContainer appContainer )
 {
     appContainer.Configure ( c => c.For<ICurrentUserPermissionService>().Use<CurrentUserPermissionService>() );
     var accessCtrlMgr = appContainer.GetInstance<IAccessControlManager> ();
     var permissionDescriptors = appContainer.GetAllInstances<IPermissionDescriptor> ();
     accessCtrlMgr.RegisterPermissionDescriptor ( permissionDescriptors.ToArray () );
 }
Exemple #13
0
 /// <summary>
 /// Configures the auto mapper.
 /// </summary>
 /// <param name="appContainer">The app container.</param>
 protected virtual void ConfigureAutoMapper( IContainer appContainer )
 {
     var originalMapperFunction = MapperRegistry.AllMappers;
     MapperRegistry.AllMappers = () =>
                                     {
                                         var mappers = ( originalMapperFunction.Invoke () as IObjectMapper[] ).ToList ();
                                         var objectMappers = appContainer.GetAllInstances<IObjectMapper> ();
                                         mappers.AddRange ( objectMappers );
                                         return mappers.ToArray ();
                                     };
 }
Exemple #14
0
 /// <summary>
 /// Calls the service registries.
 /// </summary>
 /// <param name="container">The container.</param>
 protected virtual void CallServiceRegistries(IContainer container)
 {
     var serviceRegistries = container.GetAllInstances<IServiceRegistry> ();
     foreach ( var serviceRegistry in serviceRegistries )
     {
         var serviceRegistryName = serviceRegistry.GetType ().ToString ();
         Logger.Debug ( "ServiceRegistries: {0}", serviceRegistryName );
         serviceRegistry.RegisterServices ();
     }
 }
 public IEnumerable <object> GetInstances(Type type)
 {
     return(container.GetAllInstances(type) as IEnumerable <object>);
 }