Esempio n. 1
0
 public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     base.Init( project, dependencies, aggregator );
     WebUtilities.Dependencies.Instance.RegistDependency("Atlas");
     Aggregator.RegisterAssembly(ComponentType.WebUserInterface.ToString(), "Microsoft.Web.Atlas.dll");
     Aggregator.RegisterGacAssembly(ComponentType.WebUserInterface.ToString(), "System.Web.Services");
 }
Esempio n. 2
0
 public void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     Project = project;
     Aggregator = aggregator;
     Dependencies = dependencies;
     SetExceptions();
 }
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            _filesystem.Exists(null).ReturnsForAnyArgs(true);

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] { "group1/proj1", "group1/proj2", "group2/proj3" });
            _modules.Repos.Returns(new[] { "p1Repo", "p2Repo", "p3Repo" });
            _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _patterns = new Patterns
            {
                DependencyPattern = "*.dll",
                DependencyPath = (FilePath)"lib",
                Masters = new FilePath[] { }
            };

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);
            _ruleFac.GetRulePatterns().Returns(_patterns);

            _buildCmd = Substitute.For<IBuildCmd>();

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd);
            _subject.Prepare();
            _subject.GetDependenciesAndBuild();
        }
Esempio n. 4
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );
            Model model = project.Model;

            EntityClass quotes = new EntityClass();
            quotes.Name = "QuoteOfTheDay";
            quotes.Visibility = "public";

            EntityField id = new EntityField();
            id.Name = "id";
            id.IsPreview = true;
            id.IsPrimaryKey = true;
            id.Type = IntrinsicTypes.Create("System.Int32");
            quotes.Fields.Add(id);

            EntityField quote = new EntityField();
            quote.Name = "quote";
            quote.Represents = true;
            quote.IsPreview = true;
            quote.Type = IntrinsicTypes.Create( "System.String" );
            quote.IsRequired = true;
            quote.MaxSize = 1000;
            quotes.Fields.Add(quote);

            model.Add(quotes);
        }
Esempio n. 5
0
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            var dbpath = The.Root.Navigate((FilePath)"group1/proj2/DatabaseScripts");
            _filesystem.Exists(null).ReturnsForAnyArgs(c=> c.Args()[0] as FilePath == dbpath);
            _filesystem.SortedDescendants(null,null).ReturnsForAnyArgs(new [] {(FilePath)"one",(FilePath)"two"});

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});
            _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _buildCmd = Substitute.For<IBuildCmd>();

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd);
            _subject.Prepare();
            _subject.RebuildDatabases();
        }
Esempio n. 6
0
 public Builder(IFileSystem files, IGit git, IDependencyManager depMgr, IRuleFactory rules, IBuildCmd builder)
 {
     _files = files;
     _git = git;
     _depMgr = depMgr;
     _rules = rules;
     _builder = builder;
 }
Esempio n. 7
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );

            Aggregator.RegisterGacAssembly( ComponentType.WebUserInterface.ToString(), "System.Configuration" );

            WebUtilities.Dependencies.Instance.RegistDependency("Providers");
        }
Esempio n. 8
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );

            Aggregator.RegisterComponentReference( ComponentType.WebUserInterface.ToString(), ComponentType.DataAccessLayer.ToString() );
            Aggregator.RegisterComponentReference( ComponentType.WebUserInterface.ToString(), ComponentType.Core.ToString() );
            Aggregator.RegisterGacAssembly( ComponentType.WebUserInterface.ToString(), "System.Web" );
            Aggregator.RegisterAssembly( ComponentType.WebUserInterface.ToString(), "Loki.dll" );

            WebUtilities.Dependencies.Instance.RegistDependency("ExceptionLogger");
        }
		protected override object CoreResolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey)
		{
			if ((object)dependencyManager == null)
				throw new ArgumentNullException(nameof(dependencyManager));

			if ((object)resolutionType == null)
				throw new ArgumentNullException(nameof(resolutionType));

			if ((object)selectorKey == null)
				throw new ArgumentNullException(nameof(selectorKey));

			return this.FactoryMethod.DynamicInvoke(null);
		}
		protected override object CoreResolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey)
		{
			if ((object)dependencyManager == null)
				throw new ArgumentNullException(nameof(dependencyManager));

			if ((object)resolutionType == null)
				throw new ArgumentNullException(nameof(resolutionType));

			if ((object)selectorKey == null)
				throw new ArgumentNullException(nameof(selectorKey));

			return Activator.CreateInstance(this.ActivatorType);
		}
Esempio n. 11
0
		public object Resolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey)
		{
			if ((object)dependencyManager == null)
				throw new ArgumentNullException(nameof(dependencyManager));

			if ((object)resolutionType == null)
				throw new ArgumentNullException(nameof(resolutionType));

			if ((object)selectorKey == null)
				throw new ArgumentNullException(nameof(selectorKey));

			return this.CoreResolve(dependencyManager, resolutionType, selectorKey);
		}
        public ScriptEngineContext(IResourceManager resourceManager, IDependencyManager scriptDependencies)
        {
            var envJs = resourceManager.GetStringFromAssemblyOf<ScriptEngine>("Forseti.Scripting.Scripts.env.js");

            _context = Context.enter();
            _context.setOptimizationLevel(-1);
            _scope = _context.initStandardObjects();

            AddClassAndMethods(typeof(SystemConsole));

            SystemConsole.LoggingEnabled = false;
            _context.evaluateString(_scope, envJs, "env.js", 1, null);
            SystemConsole.LoggingEnabled = true;
        }
Esempio n. 13
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );
            Model model = project.Model;

            EntityClass logger = CreateLogger();
            EntityClass principal = (EntityClass) model.GetByName("Principal");

            SetupConnection(logger, principal);

            model.Add(logger);

            WebUtilities.Dependencies.Instance.RegistDependency("RequestLogger");
        }
Esempio n. 14
0
 public void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     Project = project;
     Aggregator = aggregator;
     Dependencies = dependencies;
     Aggregator.RegisterComponent( ComponentType.Config.ToString() );
     Aggregator.RegisterGacAssembly( ComponentType.Config.ToString(), "System.Xml" );
     Aggregator.RegisterAssembly( ComponentType.Config.ToString(), "Mono.GetOptions.dll" );
     Aggregator.RegisterAssembly( ComponentType.Config.ToString(), "Loki.dll" );
     Aggregator.RegisterAssembly( ComponentType.Config.ToString(), "NVelocity.dll" );
     Aggregator.RegisterGacAssembly(ComponentType.Config.ToString(), "System.Web");
     Aggregator.RegisterComponentReference( ComponentType.Config.ToString(), ComponentType.DataAccessLayer.ToString() );
     Aggregator.RegisterComponentReference( ComponentType.Config.ToString(), ComponentType.Core.ToString() );
     Aggregator.RegisterProjectType( ComponentType.Config.ToString(), ProjectTypes.Exe );
 }
Esempio n. 15
0
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);
            _missingRepo = The.Root.Append((FilePath)"/group1/proj2");

            _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath !=_missingRepo));

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null);
            _subject.Prepare();
        }
Esempio n. 16
0
        public void builder()
        {
            _filesystem = Substitute.For<IFileSystem>();
            _filesystem.GetPlatformRoot().Returns(The.Root);

            _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath != (FilePath)"group1/proj2"));

            _modules = Substitute.For<IModules>();
            _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"});
            _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"});
            _locks = new List<AutoResetEvent> { new AutoResetEvent(false), new AutoResetEvent(false), new AutoResetEvent(false) };
            _modules.CreateAndSetLocks().Returns(_locks);

            _git = Substitute.For<IGit>();
            _depMgr = Substitute.For<IDependencyManager>();
            _ruleFac = Substitute.For<IRuleFactory>();
            _ruleFac.GetModules().Returns(_modules);

            _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null);
            _subject.Prepare();
            _subject.PullRepos();
        }
Esempio n. 17
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );

            EntityClass channel = new EntityClass("Channel", "public");
            EntityClass participants = new EntityClass("ChannelParticipant", "public");
            EntityClass entry = new EntityClass("ChannelEntry", "public");

            BuildChannel(channel);
            BuildParticipants(participants);
            BuildEntry(entry);

            BuildChannelParticipantConnection(channel, participants);
            BuildChannelEntryConnection(channel, entry);

            Project.Model.Add(channel);
            Project.Model.Add(participants);
            Project.Model.Add(entry);

            Directory.CreateDirectory(GetControlsOutputDir("Generic/LiveChat/"));
            GetRelativeOutputDir("",GetControlsOutputDir("WebControls/"));
            GetRelativeOutputDir("",GetControlsOutputDir("WebServices"));
            GetRelativeOutputDir("",GetControlsOutputDir("WebServices/LiveChat/"));
        }
 public static IDependencyManager RegisterLogStore <TLogStore>(this IDependencyManager dependencyManager)
     where TLogStore : class, ILogStore
 {
     dependencyManager.RegisterLogStore(typeof(TLogStore).GetTypeInfo());
     return(dependencyManager);
 }
        public static IDependencyManager RegisterSecureDefaultPageMiddlewareUsingDefaultConfiguration(this IDependencyManager dependencyManager)
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.RegisterOwinMiddleware <RedirectToSsoIfNotLoggedInMiddlewareConfiguration>();

            dependencyManager.RegisterDefaultPageMiddlewareUsingDefaultConfiguration();

            return(dependencyManager);
        }
Esempio n. 20
0
        public RazorSsoHtmlPageProvider(IAppEnvironmentProvider appEnvironmentProvider, IPathProvider pathProvider, IDependencyManager dependencyManager)
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            if (appEnvironmentProvider == null)
            {
                throw new ArgumentNullException(nameof(appEnvironmentProvider));
            }

            if (pathProvider == null)
            {
                throw new ArgumentNullException(nameof(pathProvider));
            }

            _dependencyManager    = dependencyManager;
            _pathProvider         = pathProvider;
            _activeAppEnvironment = appEnvironmentProvider.GetActiveAppEnvironment();
        }
Esempio n. 21
0
 public void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     Project = project;
     Aggregator = aggregator;
     Dependencies = dependencies;
     Aggregator.RegisterComponent( ComponentType.DataAccessLayer.ToString() );
     Aggregator.RegisterComponentReference( ComponentType.DataAccessLayer.ToString(), ComponentType.Core.ToString() );
     Aggregator.RegisterAssembly( ComponentType.DataAccessLayer.ToString(), "NHibernate.dll" );
     Aggregator.RegisterAssembly( ComponentType.DataAccessLayer.ToString(), "Loki.dll" );
     Aggregator.RegisterGacAssembly( ComponentType.DataAccessLayer.ToString(), "System.Data" );
     Aggregator.RegisterGacAssembly( ComponentType.DataAccessLayer.ToString(), "System.Xml" );
     Aggregator.RegisterGacAssembly( ComponentType.DataAccessLayer.ToString(), "System.Web" );
 }
Esempio n. 22
0
 public override void Init(IProject project, IDependencyManager dependencies, IBuildAggregator aggregator)
 {
     base.Init(project, dependencies, aggregator);
 }
Esempio n. 23
0
        public override void Init(IProject project, IDependencyManager dependencies, IBuildAggregator aggregator)
        {
            base.Init(project, dependencies, aggregator);

            WebUtilities.Dependencies.Instance.RegistDependency("Admin");
        }
Esempio n. 24
0
 public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     base.Init( project, dependencies, aggregator );
     dependencies.RegistDependency("Xml2aspx");
 }
        public static IDependencyManager RegisterSignalRMiddlewareUsingDefaultConfiguration(this IDependencyManager dependencyManager, params Assembly[] hubsAssemblies)
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            if (hubsAssemblies == null)
            {
                throw new ArgumentNullException(nameof(hubsAssemblies));
            }

            return(RegisterSignalRMiddlewareUsingDefaultConfiguration <DefaultMessageHubEvents>(dependencyManager, hubsAssemblies));
        }
Esempio n. 26
0
 public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     base.Init( project, dependencies, aggregator );
 }
Esempio n. 27
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );
            WebUtilities.Dependencies.Instance.RegistDependency("I18N.Independent");
            dependencies.RegistDependency("I18N.Independent");

            AddModelToLocalization();
        }
Esempio n. 28
0
 public void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     Project = project;
     Aggregator = aggregator;
     Dependencies = dependencies;
     Aggregator.RegisterComponent( ComponentType.Core.ToString() );
     Aggregator.RegisterAssembly( ComponentType.Core.ToString(), "Loki.dll" );
     Aggregator.RegisterGacAssembly(ComponentType.Core.ToString(), "System.Xml");
 }
Esempio n. 29
0
 public virtual void Init( IProject project, IDependencyManager dependencies, Dictionary<string, BuildInformation> info )
 {
     Project = project;
     information = info;
     Dependencies = dependencies;
 }
		protected override object CoreResolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey)
		{
			if ((object)dependencyManager == null)
				throw new ArgumentNullException(nameof(dependencyManager));

			if ((object)resolutionType == null)
				throw new ArgumentNullException(nameof(resolutionType));

			if ((object)selectorKey == null)
				throw new ArgumentNullException(nameof(selectorKey));

			// cop a reader lock
			this.ReaderWriterLock.EnterUpgradeableReadLock();

			try
			{
				if (this.Frozen)
					return this.Instance;

				// cop a writer lock
				this.ReaderWriterLock.EnterWriteLock();

				try
				{
					this.Instance = this.InnerDependencyResolution.Resolve(dependencyManager, resolutionType, selectorKey);
					return this.Instance;
				}
				finally
				{
					this.Frozen = true;
					this.ReaderWriterLock.ExitWriteLock();
				}
			}
			finally
			{
				this.ReaderWriterLock.ExitUpgradeableReadLock();
			}
		}
Esempio n. 31
0
 public static IDependencyManager RegisterGlobalWebApiActionFiltersUsing(this IDependencyManager dependencyManager, Action <HttpConfiguration> addGlobalActionFilters)
 {
     return(dependencyManager.RegisterGlobalWebApiCustomizerUsing(addGlobalActionFilters));
 }
Esempio n. 32
0
 public ClientAppManager(IClientAppRepo repo, IAppConfig appConfig, IAdminLogger logger, ISecureStorage secureStorage,
                         IDependencyManager depmanager, ISecurity security) : base(logger, appConfig, depmanager, security)
 {
     _repo          = repo;
     _secureStorage = secureStorage;
 }
Esempio n. 33
0
 public void Init( IProject project, IDependencyManager dependencies )
 {
     this.project = project;
     Dependencies = dependencies;
 }
 public static IDependencyManager RegisterDefaultWebApiAndODataConfiguration(this IDependencyManager dependencyManager, params Assembly[] controllersAssemblies)
 {
     dependencyManager.Register <IODataSqlBuilder, DefaultODataSqlBuilder>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
     return(dependencyManager.RegisterDefaultWebApiConfiguration(AssemblyContainer.Current.AssembliesWithDefaultAssemblies(controllersAssemblies).Union(new[] { AssemblyContainer.Current.GetBitWebApiAssembly(), AssemblyContainer.Current.GetBitODataAssembly(), typeof(MetadataController).GetTypeInfo().Assembly }).ToArray()));
 }
        public static IDependencyManager RegisterSignalRConfiguration <TSignalRConfiguration>(this IDependencyManager dependencyManager)
            where TSignalRConfiguration : class, ISignalRConfiguration
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <ISignalRConfiguration, TSignalRConfiguration>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExisting: false);

            return(dependencyManager);
        }
Esempio n. 36
0
        public virtual void ConfigureDependencies(IServiceProvider serviceProvider, IServiceCollection services, IDependencyManager dependencyManager)
        {
            AssemblyContainer.Current.Init();

            dependencyManager.RegisterMinimalDependencies();

            dependencyManager.RegisterDefaultLogger(typeof(DebugLogStore).GetTypeInfo(), typeof(ConsoleLogStore).GetTypeInfo());

            dependencyManager.RegisterDefaultOwinCoreApp();

            dependencyManager.RegisterMinimalOwinCoreMiddlewares();

            dependencyManager.RegisterDefaultWebApiConfiguration();

            dependencyManager.RegisterWebApiMiddleware(webApiDependencyManager =>
            {
                webApiDependencyManager.RegisterWebApiMiddlewareUsingDefaultConfiguration();
            });
        }
Esempio n. 37
0
        public static IDependencyManager RegisterODataServiceBuilder <TODataServiceBuilder>(this IDependencyManager dependencyManager)
            where TODataServiceBuilder : class, IODataServiceBuilder
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <IODataServiceBuilder, TODataServiceBuilder>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);

            return(dependencyManager);
        }
Esempio n. 38
0
 public BitChangeSetManagerInitialData(IDependencyManager dependencyManager, IAppEnvironmentProvider appEnvironmentProvider, IDateTimeProvider dateTimeProvider)
 {
     _dependencyManager      = dependencyManager;
     _dateTimeProvider       = dateTimeProvider;
     _appEnvironmentProvider = appEnvironmentProvider;
 }
 protected abstract ValueTask <TResolution> CoreResolveAsync(IDependencyManager dependencyManager, string selectorKey, CancellationToken cancellationToken = default);
Esempio n. 40
0
 public void SetUp()
 {
     StreamCipherServiceLocator.ClearServices();
     _resolver = new ProgrammaticDependencyManager();
     _resolver.Register<IDummyInterface, DummyImplementation>();
 }
Esempio n. 41
0
        public virtual void ConfigureDependencies(IServiceCollection services, IDependencyManager dependencyManager)
        {
            AssemblyContainer.Current.Init();

            dependencyManager.RegisterMinimalDependencies();

            dependencyManager.RegisterDefaultLogger(typeof(ConsoleLogStore).GetTypeInfo(), typeof(DebugLogStore).GetTypeInfo());

            dependencyManager.Register <IDbConnectionProvider, DefaultDbConnectionProvider <SqlConnection> >();

            dependencyManager.RegisterAppEvents <InitialTestDataConfiguration>();

            dependencyManager.RegisterDefaultAspNetCoreApp();

            dependencyManager.RegisterAspNetCoreMiddleware <AspNetCoreStaticFilesMiddlewareConfiguration>();
            dependencyManager.RegisterMinimalAspNetCoreMiddlewares();

            dependencyManager.RegisterAspNetCoreSingleSignOnClient();

            services.AddWebApiCore(dependencyManager);
            dependencyManager.RegisterAspNetCoreMiddleware <TestWebApiCoreMvcMiddlewareConfiguration>();

            dependencyManager.RegisterMetadata();

            dependencyManager.RegisterDefaultWebApiAndODataConfiguration();

            dependencyManager.RegisterWebApiMiddleware(webApiDependencyManager =>
            {
                webApiDependencyManager.RegisterWebApiMiddlewareUsingDefaultConfiguration();

                webApiDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.Filters.Add(new AuthorizeAttribute());
                });

                webApiDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableMultiVersionWebApiSwagger();
                });
            });

            dependencyManager.RegisterODataMiddleware(odataDependencyManager =>
            {
                odataDependencyManager.RegisterWebApiODataMiddlewareUsingDefaultConfiguration();

                odataDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.Filters.Add(new DefaultODataAuthorizeAttribute());
                });

                odataDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableSwagger(c =>
                    {
                        c.SingleApiVersion("All", "Swagger-OData");
                        c.ApplyDefaultODataConfig(httpConfiguration);
                    }).EnableBitSwaggerUi();
                });
            });

            dependencyManager.RegisterSignalRConfiguration <SignalRAuthorizeConfiguration>();
            dependencyManager.RegisterSignalRMiddlewareUsingDefaultConfiguration();

            dependencyManager.RegisterHangfireBackgroundJobWorkerUsingDefaultConfiguration <JobSchedulerInMemoryBackendConfiguration>();

            dependencyManager.RegisterRepository(typeof(TestEfRepository <>).GetTypeInfo());

            if (Settings.Default.UseInMemoryProviderByDefault)
            {
                dependencyManager.RegisterEfCoreDbContext <TestDbContext, InMemoryDbContextObjectsProvider>();
            }
            else
            {
                dependencyManager.RegisterEfCoreDbContext <TestDbContext, SqlServerDbContextObjectsProvider>();
            }

            dependencyManager.RegisterDtoEntityMapper();

            dependencyManager.RegisterMapperConfiguration <DefaultMapperConfiguration>();
            dependencyManager.RegisterMapperConfiguration <TestMapperConfiguration>();

            dependencyManager.RegisterSingleSignOnServer <TestUserService, TestOAuthClientsProvider>();

            _args?.AdditionalDependencies?.Invoke(dependencyManager, services);

            dependencyManager.RegisterSecureIndexPageMiddlewareUsingDefaultConfiguration();
        }
Esempio n. 42
0
		protected abstract object CoreResolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey);
        public static IDependencyManager RegisterDefaultPageMiddlewareUsingDefaultConfiguration(this IDependencyManager dependencyManager)
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <IDefaultHtmlPageProvider, RazorDefaultHtmlPageProvider>(overwriteExciting: false);
            dependencyManager.Register <IDefaultPageModelProvider, DefaultPageModelProvider>(overwriteExciting: false);

            dependencyManager.RegisterOwinMiddleware <DefaultPageMiddlewareConfiguration>();

            return(dependencyManager);
        }
Esempio n. 44
0
        public virtual void ConfigureDependencies(IServiceProvider serviceProvider, IServiceCollection services, IDependencyManager dependencyManager)
        {
            AssemblyContainer.Current.Init();
            AssemblyContainer.Current.AddAppAssemblies(AssemblyContainer.Current.GetBitChangeSetManagerAssembly());

            dependencyManager.RegisterMinimalDependencies();

            dependencyManager.RegisterDefaultLogger(typeof(DebugLogStore).GetTypeInfo(), typeof(ConsoleLogStore).GetTypeInfo());

            dependencyManager.Register <IDbConnectionProvider, DefaultDbConnectionProvider <SqlConnection> >();

            dependencyManager.RegisterAppEvents <BitChangeSetManagerInitialData>();
            dependencyManager.RegisterAppEvents <RazorViewEngineConfiguration>();

            dependencyManager.RegisterDefaultOwinCoreApp();

            services.AddCors();
            dependencyManager.RegisterAspNetCoreMiddlewareUsing(aspNetCoreApp =>
            {
                aspNetCoreApp.UseCors(c => c.AllowAnyOrigin());
            });

            dependencyManager.RegisterAspNetCoreMiddleware <AspNetCoreStaticFilesMiddlewareConfiguration>();
            dependencyManager.RegisterMinimalOwinCoreMiddlewares();
            dependencyManager.RegisterAspNetCoreSingleSignOnClient();

            dependencyManager.RegisterMetadata();

            dependencyManager.RegisterDefaultWebApiAndODataConfiguration();

            dependencyManager.RegisterWebApiMiddleware(webApiDependencyManager =>
            {
                webApiDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.Filters.Add(new System.Web.Http.AuthorizeAttribute());
                });

                webApiDependencyManager.RegisterGlobalWebApiCustomizerUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableSwagger(c =>
                    {
                        EnvironmentAppInfo appInfo = DefaultAppEnvironmentProvider.Current.GetActiveAppEnvironment().AppInfo;
                        c.SingleApiVersion($"v{appInfo.Version}", $"{appInfo.Name}-Api");
                        c.ApplyDefaultApiConfig(httpConfiguration);
                    }).EnableSwaggerUi();
                });

                webApiDependencyManager.RegisterWebApiMiddlewareUsingDefaultConfiguration();
            });

            dependencyManager.RegisterODataMiddleware(odataDependencyManager =>
            {
                odataDependencyManager.RegisterGlobalWebApiActionFiltersUsing(httpConfiguration =>
                {
                    httpConfiguration.Filters.Add(new DefaultODataAuthorizeAttribute());
                });

                odataDependencyManager.RegisterGlobalWebApiCustomizerUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableSwagger(c =>
                    {
                        EnvironmentAppInfo appInfo = DefaultAppEnvironmentProvider.Current.GetActiveAppEnvironment().AppInfo;
                        c.SingleApiVersion($"v{appInfo.Version}", $"{appInfo.Name}-Api");
                        c.ApplyDefaultODataConfig(httpConfiguration);
                    }).EnableSwaggerUi();
                });

                odataDependencyManager.RegisterODataServiceBuilder <BitODataServiceBuilder>();
                odataDependencyManager.RegisterODataServiceBuilder <BitChangeSetManagerODataServiceBuilder>();
                odataDependencyManager.RegisterWebApiODataMiddlewareUsingDefaultConfiguration();
            });

            if (DefaultAppEnvironmentProvider.Current.GetActiveAppEnvironment().DebugMode == false)
            {
                dependencyManager.RegisterSignalRConfiguration <SignalRSqlServerScaleoutConfiguration>();
            }
            dependencyManager.RegisterSignalRConfiguration <SignalRAuthorizeConfiguration>();
            dependencyManager.RegisterSignalRMiddlewareUsingDefaultConfiguration <BitChangeSetManagerAppMessageHubEvents>();

            dependencyManager.RegisterHangfireBackgroundJobWorkerUsingDefaultConfiguration <JobSchedulerInMemoryBackendConfiguration>();

            dependencyManager.RegisterGeneric(typeof(IBitChangeSetManagerRepository <>).GetTypeInfo(), typeof(BitChangeSetManagerEfRepository <>).GetTypeInfo(), DependencyLifeCycle.InstancePerLifetimeScope);

            dependencyManager.RegisterEfDbContext <BitChangeSetManagerDbContext>();

            dependencyManager.RegisterDtoEntityMapper();

            dependencyManager.RegisterDtoEntityMapperConfiguration <DefaultDtoEntityMapperConfiguration>();
            dependencyManager.RegisterDtoEntityMapperConfiguration <BitChangeSetManagerDtoEntityMapperConfiguration>();

            dependencyManager.RegisterSingleSignOnServer <BitChangeSetManagerUserService, BitChangeSetManagerClientProvider>();

            dependencyManager.RegisterSecureDefaultPageMiddlewareUsingDefaultConfiguration();

            dependencyManager.Register <IChangeSetRepository, ChangeSetRepository>();
            dependencyManager.Register <IUserSettingProvider, BitUserSettingProvider>();
        }
 public static IDependencyManager RegisterLogStore(this IDependencyManager dependencyManager, TypeInfo logStore)
 {
     dependencyManager.Register(typeof(ILogStore).GetTypeInfo(), logStore, overwriteExciting: false);
     return(dependencyManager);
 }
Esempio n. 46
0
 public void Init(IProject project, IDependencyManager dependencies, Dictionary <string, BuildInformation> info)
 {
     Project      = project;
     information  = info;
     Dependencies = dependencies;
 }
Esempio n. 47
0
        public static IDependencyManager RegisterWebApiConfigurationCustomizer <TWebApiConfigurationCustomizer>(this IDependencyManager dependencyManager)
            where TWebApiConfigurationCustomizer : class, IWebApiConfigurationCustomizer
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <IWebApiConfigurationCustomizer, TWebApiConfigurationCustomizer>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);

            return(dependencyManager);
        }
        public static IDependencyManager RegisterSignalRMiddlewareUsingDefaultConfiguration <TMessagesHubEvents>(this IDependencyManager dependencyManager, params Assembly[] hubsAssemblies)
            where TMessagesHubEvents : class, IMessagesHubEvents
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            if (hubsAssemblies == null)
            {
                throw new ArgumentNullException(nameof(hubsAssemblies));
            }

            hubsAssemblies = AssemblyContainer.Current.AssembliesWithDefaultAssemblies(hubsAssemblies).Union(new[] { AssemblyContainer.Current.GetServerSignalRAssembly() }).ToArray();

            dependencyManager.RegisterAssemblyTypes(hubsAssemblies, t => typeof(Hub).GetTypeInfo().IsAssignableFrom(t), lifeCycle: DependencyLifeCycle.Transient);
            dependencyManager.Register <IMessagesHubEvents, TMessagesHubEvents>(overwriteExisting: false);
            dependencyManager.Register <IMessageSender, SignalRMessageSender>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExisting: false);
            dependencyManager.Register <IMessageContentFormatter, SignalRMessageContentFormatter>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExisting: false);
            dependencyManager.Register <Microsoft.AspNet.SignalR.IDependencyResolver, AutofacDependencyResolver>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExisting: false);
            dependencyManager.RegisterInstance <Microsoft.AspNet.SignalR.Hubs.IAssemblyLocator>(new DefaultSignalRAssemblyLocator(hubsAssemblies), overwriteExisting: false);

            dependencyManager.RegisterOwinMiddleware <SignalRMiddlewareConfiguration>();

            return(dependencyManager);
        }
Esempio n. 49
0
        /// <summary>
        /// Adds minimal dependencies to make web api work. It registers <see cref="System.Web.Http.Dependencies.IDependencyResolver"/> by <see cref="AutofacWebApiDependencyResolver"/>
        /// | <see cref="IWebApiOwinPipelineInjector"/> by <see cref="DefaultWebApiOwinPipelineInjector"/>
        /// It adds <see cref="LogOperationInfoFilterAttribute"/> and <see cref="ExceptionHandlerFilterAttribute"/> action filters
        /// It registers <see cref="WebApiMiddlewareConfiguration"/> middleware
        /// </summary>
        public static IDependencyManager RegisterWebApiMiddlewareUsingDefaultConfiguration(this IDependencyManager dependencyManager, string name = "WebApi")
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <System.Web.Http.Dependencies.IDependencyResolver, AutofacWebApiDependencyResolver>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.Register <IWebApiOwinPipelineInjector, DefaultWebApiOwinPipelineInjector>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultLogOperationInfoActionFilterProvider <LogOperationInfoFilterAttribute> >();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultExceptionHandlerActionFilterProvider <ExceptionHandlerFilterAttribute> >();
            dependencyManager.RegisterOwinMiddleware <WebApiMiddlewareConfiguration>(name);

            return(dependencyManager);
        }
Esempio n. 50
0
        public override void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
        {
            base.Init( project, dependencies, aggregator );

            WebUtilities.Dependencies.Instance.RegistDependency("Admin");
        }
        public static IDependencyManager RegisterWebApiODataMiddlewareUsingDefaultConfiguration(this IDependencyManager dependencyManager, string name = "WebApiOData")
        {
            if (dependencyManager == null)
            {
                throw new ArgumentNullException(nameof(dependencyManager));
            }

            dependencyManager.Register <System.Web.Http.Dependencies.IDependencyResolver, AutofacWebApiDependencyResolver>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.Register <IWebApiOwinPipelineInjector, DefaultWebApiODataOwinPipelineInjector>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.RegisterWebApiConfigurationCustomizer <ReadRequestContentStreamAsyncActionFilterAttribute>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultRequestQSStringCorrectorsApplierActionFilterProvider>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultRequestQSTimeZoneApplierActionFilterProvider>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalODataNullReturnValueActionFilterProvider>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <DefaultGlobalEnableQueryActionFilterProvider>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultLogOperationInfoActionFilterProvider <ODataLogOperationInfoFilterAttribute> >();
            dependencyManager.RegisterWebApiConfigurationCustomizer <ThrowAnExceptionForRequestBodyJsonParseEerrorActionFilter>();
            dependencyManager.RegisterWebApiConfigurationCustomizer <GlobalDefaultExceptionHandlerActionFilterProvider <ODataExceptionHandlerFilterAttribute> >();
            dependencyManager.Register <IODataModuleConfiguration, DefaultODataModuleConfiguration>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.Register <IContainerBuilder, DefaultODataContainerBuilder>(lifeCycle: DependencyLifeCycle.Transient, overwriteExciting: false);
            dependencyManager.Register <IODataModelBuilderProvider, DefaultODataModelBuilderProvider>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.Register <System.Web.Http.Controllers.IHttpActionSelector, DefaultWebApiODataControllerActionSelector>(lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);
            dependencyManager.RegisterOwinMiddleware <WebApiODataMiddlewareConfiguration>(name);

            return(dependencyManager);
        }
Esempio n. 52
0
 public void Init(IProject project, IDependencyManager dependencies, IBuildAggregator aggregator)
 {
     Project      = project;
     Aggregator   = aggregator;
     Dependencies = dependencies;
 }
        public static IDependencyManager RegisterODataMiddleware(this IDependencyManager dependencyManager, Action <IDependencyManager> onConfigure)
        {
            dependencyManager.RegisterUsing((resolver) => dependencyManager.CreateChildDependencyResolver(onConfigure).Resolve <IOwinMiddlewareConfiguration>("WebApiOData"), lifeCycle: DependencyLifeCycle.SingleInstance, overwriteExciting: false);

            return(dependencyManager);
        }
Esempio n. 54
0
 public DeviceAdminManager(IDeviceWorkflowRepo deviceWorkflowRepo, IUnitSetRepo unitSetRepo, IStateMachineRepo stateMachineRepo,
                           IStateSetRepo stateSetRepo, IEventSetRepo eventSetRepo, IDependencyManager depManager, ISecurity securityManager, IAdminLogger logger, IAppConfig appConfig) :
     base(logger, appConfig, depManager, securityManager)
 {
     _deviceWorkflowRepo = deviceWorkflowRepo;
     _unitSetRepo        = unitSetRepo;
     _stateMachineRepo   = stateMachineRepo;
     _stateSetRepo       = stateSetRepo;
     _eventSetRepo       = eventSetRepo;
 }
Esempio n. 55
0
 public SimulatorManager(ISimulatorRepo simulatorRepo, ISecureStorage secureStorage, IAdminLogger logger, IAppConfig appConfig, IDependencyManager depmanager, ISecurity security) :
     base(logger, appConfig, depmanager, security)
 {
     _simulatorRepo = simulatorRepo;
     _secureStorage = secureStorage;
 }
Esempio n. 56
0
 public DeviceLogManager(IDeviceLogRepo logRepo, IAdminLogger logger, IAppConfig appConfig, IDependencyManager depmanager, ISecurity security) :
     base(logger, appConfig, depmanager, security)
 {
     _logRepo = logRepo;
 }
Esempio n. 57
0
        public virtual void ConfigureDependencies(IServiceCollection services, IDependencyManager dependencyManager)
        {
            AssemblyContainer.Current.Init();

            dependencyManager.RegisterMinimalDependencies();

            dependencyManager.RegisterDefaultLogger(typeof(DebugLogStore).GetTypeInfo(), typeof(ConsoleLogStore).GetTypeInfo());

            dependencyManager.RegisterDefaultAspNetCoreApp();

            services.AddResponseCompression(options => options.EnableForHttps = true);
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist/";
            });

            dependencyManager.RegisterAspNetCoreMiddlewareUsing(aspNetCoreApp =>
            {
                aspNetCoreApp.UseResponseCompression();
                aspNetCoreApp.UseHttpsRedirection();
                aspNetCoreApp.UseStaticFiles();
                aspNetCoreApp.UseSpaStaticFiles();
            });

            dependencyManager.RegisterMinimalAspNetCoreMiddlewares();

            dependencyManager.RegisterMetadata();

            dependencyManager.RegisterOwinMiddleware <ClientAppProfileMiddlewareConfiguration>(); // https://github.com/bit-foundation/bit-framework/issues/165

            dependencyManager.RegisterDefaultWebApiAndODataConfiguration();

            dependencyManager.RegisterWebApiMiddleware(webApiDependencyManager =>
            {
                webApiDependencyManager.RegisterWebApiMiddlewareUsingDefaultConfiguration();

                webApiDependencyManager.RegisterGlobalWebApiCustomizerUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableSwagger(c =>
                    {
                        c.SingleApiVersion("v1", $"Swagger-Api");
                        c.ApplyDefaultApiConfig(httpConfiguration);
                    }).EnableBitSwaggerUi();
                });
            });

            dependencyManager.RegisterODataMiddleware(odataDependencyManager =>
            {
                odataDependencyManager.RegisterGlobalWebApiCustomizerUsing(httpConfiguration =>
                {
                    httpConfiguration.EnableSwagger(c =>
                    {
                        c.SingleApiVersion("v1", $"Swagger-Api");
                        c.ApplyDefaultODataConfig(httpConfiguration);
                    }).EnableBitSwaggerUi();
                });

                odataDependencyManager.RegisterWebApiODataMiddlewareUsingDefaultConfiguration();
            });

            dependencyManager.RegisterDtoEntityMapper();
            dependencyManager.RegisterMapperConfiguration <DefaultMapperConfiguration>();

            dependencyManager.RegisterAspNetCoreMiddlewareUsing(aspNetCoreApp =>
            {
                /*aspNetCoreApp.Use(async (cntx, next) =>
                 * {
                 *  cntx.Response.OnStarting(async () =>
                 *  {
                 *      cntx.Response.Headers.Add("Link", "<https://localhost:5001/styles.f5fe6687c43885ea4695.css>; rel=preload; as=style, <https://localhost:5001/runtime-es2015.e59a6cd8f1b6ab0c3f29.js>; rel=preload; as=script, <https://localhost:5001/polyfills-es2015.58725a5910daef768ca8.js>; rel=preload; as=script, <https://localhost:5001/main-es2015.79bc87a12189b9a95f11.js>; rel=preload; as=script");
                 *      // index.html: <link rel="stylesheet" href="https://localhost:5001/styles.f5fe6687c43885ea4695.css">
                 *  });
                 *
                 *  await next();
                 * });*/

                aspNetCoreApp.UseSpa(spa =>
                {
                    spa.Options.SourcePath = "ClientApp";

#if BuildServerSideRenderer
                    spa.UseSpaPrerendering(options =>
                    {
                        options.BootModulePath    = $"{spa.Options.SourcePath}/dist/main.js";
                        options.BootModuleBuilder = AspNetCoreAppEnvironmentsProvider.Current.WebHostEnvironment.IsDevelopment()
                            ? new AngularCliBuilder(npmScript: "build:ssr")
                            : null;
                        options.ExcludeUrls = new[] { "/sockjs-node" };

                        options.SupplyData = (httpContext, data) =>
                        {
                            string[] SeachEnginesUserAgents = new string[] {
                                "google",
                                "bing",
                                "linkedin",
                            };

                            string agent = httpContext.Request.Headers["User-Agent"];

                            bool isSearchEngine = SeachEnginesUserAgents.Any(a => agent.Contains(a, StringComparison.InvariantCultureIgnoreCase));

                            data.Add("isSearchEngine", isSearchEngine); // see main.server.ts
                        };
                    });
#endif
                    if (AspNetCoreAppEnvironmentsProvider.Current.WebHostEnvironment.IsDevelopment())
                    {
                        spa.UseAngularCliServer(npmScript: "start");
                    }
                });
            }, MiddlewarePosition.AfterOwinMiddlewares);
        }
Esempio n. 58
0
 public DeviceTypeManager(IDeviceTypeRepo deviceTypeRepo, IDeviceAdminManager deviceAdminManager,
                          IAdminLogger logger, IAppConfig appConfig, IDependencyManager depmanager, ISecurity security) :
     base(logger, appConfig, depmanager, security)
 {
     _deviceTypeRepo = deviceTypeRepo;
 }
		protected override object CoreResolve(IDependencyManager dependencyManager, Type resolutionType, string selectorKey)
		{
			string key;
			object value;

			if ((object)dependencyManager == null)
				throw new ArgumentNullException(nameof(dependencyManager));

			if ((object)resolutionType == null)
				throw new ArgumentNullException(nameof(resolutionType));

			if ((object)selectorKey == null)
				throw new ArgumentNullException(nameof(selectorKey));

			key = string.Format("{0}_{1}", resolutionType.FullName, selectorKey);

			if (!this.ContextualStorageStrategy.HasValue(key))
			{
				value = this.InnerDependencyResolution.Resolve(dependencyManager, resolutionType, selectorKey);
				this.ContextualStorageStrategy.SetValue<object>(key, value);

				this.TrackedContextKeys.Add(key);
			}
			else
				value = this.ContextualStorageStrategy.GetValue<object>(key);

			return value;
		}
Esempio n. 60
0
 public void Init( IProject project, IDependencyManager dependencies, IBuildAggregator aggregator )
 {
     Project = project;
     Aggregator = aggregator;
     Dependencies = dependencies;
     Aggregator.RegisterComponent( ComponentType.Tests.ToString() );
     Aggregator.RegisterComponentReference( ComponentType.Tests.ToString(),ComponentType.Core.ToString() );
     Aggregator.RegisterComponentReference( ComponentType.Tests.ToString(), ComponentType.DataAccessLayer.ToString() );
     Aggregator.RegisterAssembly( ComponentType.Tests.ToString(), "Loki.dll");
     Aggregator.RegisterAssembly( ComponentType.Tests.ToString(), "nunit.framework.dll" );
 }