Esempio n. 1
0
 public DatabaseInitializer(ILifetimeScope scope, ITypeScanner typeScanner, SmartConfiguration appConfig)
 {
     _scope       = scope;
     _appConfig   = appConfig;
     _typeScanner = typeScanner;
     _seedersMap  = DiscoverDataSeeders().ToMultimap(key => key.ContextType, value => value.SeederType);
 }
Esempio n. 2
0
        public static ITypeScanner For <TConvention>(this ITypeScanner scanner) where TConvention : IConvention, new()
        {
            Guard.IsNotNull(scanner, "scanner");

            scanner.AddConvention(new TConvention());
            return(scanner);
        }
Esempio n. 3
0
        public InstallPermissionsInitializer(SmartDbContext db, /* IPermissionService permissionService,*/ ITypeScanner typeScanner)
        {
            // TODO: (core) Resolving IPermissionService in initializer throws. Why? Investigate,

            _db = db;
            //_permissionService = permissionService;
            _typeScanner = typeScanner;
        }
Esempio n. 4
0
 public override void SetUp()
 {
     base.SetUp();
     typeScanner = new DefaultTypeScanner(
         new ModuleCatalog(),
         NullLogger.Instance,
         typeof(TypeScannerBase).Assembly);
 }
Esempio n. 5
0
 public RootApplicationInitializer(
     IComponentContext scope,
     ITypeScanner typeScanner,
     ILogger <RootApplicationInitializer> logger)
 {
     _scope       = scope;
     _typeScanner = typeScanner;
     _logger      = logger;
 }
Esempio n. 6
0
 internal void AddTypeScanner(ITypeScanner typeScanner)
 {
     if (typeScanner == null)
     {
         throw new ArgumentNullException("typeScanner");
     }
     if (!_typeScanners.Contains(typeScanner))
     {
         _typeScanners.Add(typeScanner);
     }
 }
        /// <summary>
        /// Adds a scanner to the configurator.
        /// </summary>
        /// <param name="scanner">An <see cref="ITypeScanner"/> instance to add.</param>
        /// <returns>A reference to the current <see cref="ITypeScannerConfigurator"/> instance.</returns>
        public ITypeScannerConfigurator Scanner(ITypeScanner scanner)
        {
            if (scanner == null)
            {
                throw new ArgumentNullException("scanner", "The scanner argument cannot be null.");
            }

            this.InternalTypeScanner.Add(scanner);

            return this;
        }
        public void With <T>() where T : ITypeScanner, new()
        {
            _scanners.RemoveAll(scanner => scanner is T);

            ITypeScanner previous = _scanners.FirstOrDefault(scanner => scanner is T);

            if (previous == null)
            {
                With(new T());
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Adds a scanner to the configurator.
        /// </summary>
        /// <param name="scanner">An <see cref="ITypeScanner"/> instance to add.</param>
        /// <returns>A reference to the current <see cref="ITypeScannerConfigurator"/> instance.</returns>
        public ITypeScannerConfigurator Scanner(ITypeScanner scanner)
        {
            if (scanner == null)
            {
                throw new ArgumentNullException("scanner", "The scanner argument cannot be null.");
            }

            this.InternalTypeScanner.Add(scanner);

            return(this);
        }
        /// <summary>
        /// Adds an <see cref="ITypeScanner"/> instance to the aggregate scanner.
        /// </summary>
        /// <param name="scanner">The <see cref="ITypeScanner"/> instance to add to the aggregate scanner.</param>
        /// <exception cref="ArgumentNullException">The value of the <paramref name="scanner"/> parameter cannot be <see langword="null"/>.</exception>
        public void Add(ITypeScanner scanner)
        {
            if (scanner == null)
            {
                throw new ArgumentNullException("scanner", "The value of the scanner parameter cannot be null.");
            }

            lock (this.instanceLock)
            {
                this.Scanners.Add(scanner);
            }
        }
        /// <summary>
        /// Adds an <see cref="ITypeScanner"/> instance to the aggregate scanner.
        /// </summary>
        /// <param name="scanner">The <see cref="ITypeScanner"/> instance to add to the aggregate scanner.</param>
        /// <exception cref="ArgumentNullException">The value of the <paramref name="scanner"/> parameter cannot be <see langword="null"/>.</exception>
        public void Add(ITypeScanner scanner)
        {
            if (scanner == null)
            {
                throw new ArgumentNullException("scanner", "The value of the scanner parameter cannot be null.");
            }

            lock(this.instanceLock)
            {
                this.Scanners.Add(scanner);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Scans the specified closure.
        /// </summary>
        /// <param name="closure">The closure.</param>
        public void Scan(Action <ITypeScannerConfigurator> closure)
        {
            if (closure == null)
            {
                throw new ArgumentNullException("closure", "The closure cannot be null.");
            }

            var configurator =
                new TypeScannerConfigurator();

            closure.Invoke(configurator);

            this.TypeScanner =
                configurator.GetTypeScanner();
        }
Esempio n. 13
0
        public TimedTypeScanner(
            IDiagnosticReporter diagnosticReporter,
            ITypeScanner typeScanner
            )
        {
            if (diagnosticReporter is null)
            {
                throw new ArgumentNullException(nameof(diagnosticReporter));
            }

            if (typeScanner is null)
            {
                throw new ArgumentNullException(nameof(typeScanner));
            }

            _diagnosticReporter = diagnosticReporter;
            _typeScanner        = typeScanner;
        }
Esempio n. 14
0
 public InstallPermissionsInitializer(SmartDbContext db, IPermissionService permissionService, ITypeScanner typeScanner)
 {
     _db = db;
     _permissionService = permissionService;
     _typeScanner       = typeScanner;
 }
Esempio n. 15
0
 public void With(ITypeScanner typeScanner)
 {
     _scanners.Add(typeScanner);
 }
Esempio n. 16
0
 /// <summary>
 /// Find all types that are subclasses of <typeparamref name="T"/> in all known assemblies.
 /// </summary>
 /// <typeparam name="T">The base type to check for</typeparam>
 /// <param name="concreteTypesOnly">Whether abstract types should be skipped.</param>
 /// <param name="ignoreInactiveModules">Speciifies whether inactive module's assemblies should be ignored.</param>
 /// <returns>Matching types</returns>
 public static IEnumerable <Type> FindTypes <T>(this ITypeScanner scanner, bool concreteTypesOnly = true, bool ignoreInactiveModules = false)
 {
     return(scanner.FindTypes(typeof(T), concreteTypesOnly, ignoreInactiveModules));
 }
Esempio n. 17
0
 /// <summary>
 /// Find all types that are subclasses of <typeparamref name="T"/> in all passed <paramref name="assemblies"/>.
 /// </summary>
 /// <param name="baseType">The base type to check for.</param>
 /// <param name="concreteTypesOnly">Whether abstract types should be skipped.</param>
 /// <param name="assemblies">Assemblies to scan.</param>
 /// <returns>Matching types</returns>
 public static IEnumerable <Type> FindTypes <T>(this ITypeScanner scanner, IEnumerable <Assembly> assemblies, bool concreteTypesOnly = true)
 {
     return(scanner.FindTypes(typeof(T), assemblies, concreteTypesOnly));
 }
Esempio n. 18
0
 public void With(ITypeScanner typeScanner)
 {
     Context.AddTypeScanner(typeScanner);
 }
 public void With(ITypeScanner scanner)
 {
     _scanners.Fill(scanner);
 }
Esempio n. 20
0
 public MenuPublisher(ITypeScanner typeScanner, IRequestCache requestCache)
 {
     _typeScanner  = typeScanner;
     _requestCache = requestCache;
 }
Esempio n. 21
0
 internal void AddTypeScanner(ITypeScanner typeScanner)
 {
     if (typeScanner == null) throw new ArgumentNullException("typeScanner");
     if (!_typeScanners.Contains(typeScanner))
         _typeScanners.Add(typeScanner);
 }