コード例 #1
0
 public ScanningContext(IServiceCollection services)
 {
     if (services == null)
     {
         throw new ArgumentNullException(nameof(services));
     }
     LocalServices.TryAddSingleton(services);
 }
コード例 #2
0
        public void Initialize()
        {
            // Guard against double initialization
            if (Initialized)
            {
                throw new ScanningContextInitializedException();
            }
            Initialized = true;

            // Initialize the modules
            using var serviceProvider = LocalServices.BuildServiceProvider();
            var modules = _modulesTypeInfo
                          .KeepOnlyDependencyInjectionModules()
                          .Distinct()
            ;

            foreach (var module in modules)
            {
                using var _ = ActivatorUtilities.CreateInstance(serviceProvider, module.AsType()) as IDisposable;
            }
        }
コード例 #3
0
        public LocalModel GetLocalById(String _idLocal)
        {
            var _local = new LocalServices().GetLocalById(_idLocal);

            return(_local);
        }