public ClientController(IDependencyFactory dependencyFactory) { _clientDetailsService = dependencyFactory.GetInstance<IClientDetailsService>(); _employeeRepository = dependencyFactory.GetInstance<IEmployeeRepository>(); _checklistRepository = dependencyFactory.GetInstance<BusinessSafe.Domain.RepositoryContracts.SafeCheck.ICheckListRepository>(); //_employeeRepository = ObjectFactory.GetInstance<IEmployeeRepository>(); }
public IndustryController(IDependencyFactory dependencyFactory) { _industryRepository = dependencyFactory.GetInstance<IChecklistTemplateRepository>(); _industryQuestionRepository = dependencyFactory.GetInstance<IChecklistTemplateQuestionRepository>(); _questionRepository = dependencyFactory.GetInstance<IQuestionRepository>(); _userForAuditingRepository = dependencyFactory.GetInstance<BusinessSafe.Domain.RepositoryContracts.IUserForAuditingRepository>(); }
public QuestionController(IDependencyFactory dependencyFactory) { _questionRepo = dependencyFactory.GetInstance<IQuestionRepository>(); ; _categoryRepo = dependencyFactory.GetInstance<ICategoryRepository>(); _industryRepository = dependencyFactory.GetInstance<IChecklistTemplateRepository>(); _userForAuditingRepository = dependencyFactory.GetInstance<BusinessSafe.Domain.RepositoryContracts.IUserForAuditingRepository>(); _reportLetterStatementCategoryRepo = dependencyFactory.GetInstance<IRepository<ReportLetterStatementCategory, Guid>>(); }
public QualityControlService(IDependencyFactory dependencyFactory) { _bus = dependencyFactory.GetInstance<IBus>(); _clientDetailsService = dependencyFactory.GetInstance<IClientDetailsService>(); _consultantRepo = dependencyFactory.GetInstance<IConsultantRepository>(); _getCompleteChecklistQuery = dependencyFactory.GetInstance<IGetCompleteChecklistsQuery>(); _qaAdvisorRepository = dependencyFactory.GetInstance<IQaAdvisorRepository>(); _lastQaAdvisorAssignedRepository = dependencyFactory.GetInstance<IRepository<LastQaAdvisorAssigned, int>>(); _favouriteChecklistRepository = dependencyFactory.GetInstance<IFavouriteChecklistRepository>(); }
public ChecklistController(IDependencyFactory dependencyFactory) { _checklistRepository = dependencyFactory.GetInstance<ICheckListRepository>(); _questionRepository = dependencyFactory.GetInstance<IQuestionRepository>(); _questionResponseRepository = dependencyFactory.GetInstance<IQuestionResponseRepository>(); _clientDetailsService = dependencyFactory.GetInstance<IClientDetailsService>(); _getChecklistsQuery = dependencyFactory.GetInstance<IGetChecklistsQuery>(); _checklistQuestionRepository = dependencyFactory.GetInstance<IChecklistQuestionRepository>(); _employeeRespository = dependencyFactory.GetInstance<IEmployeeRepository>(); _impressionRespository = dependencyFactory.GetInstance<IImpressionTypeRepository>(); _categoryRepository = dependencyFactory.GetInstance<ICategoryRepository>(); _timescaleRepository = dependencyFactory.GetInstance<ITimescaleRepository>(); _userForAuditingRepository = dependencyFactory.GetInstance<IUserForAuditingRepository>(); _siteRepository = dependencyFactory.GetInstance<ISiteRepository>(); _checklistPdfCreator = dependencyFactory.GetInstance<IChecklistPdfCreator>(); _clientDocumentationChecklistPdfWriter = dependencyFactory.GetInstance<IClientDocumentationChecklistPdfWriter>(); _log = dependencyFactory.GetInstance<IPeninsulaLog>(); _qaAdvisorRepository = dependencyFactory.GetInstance<IQaAdvisorRepository>(); _industryRepository = dependencyFactory.GetInstance<IIndustryRepository>(); _bus = dependencyFactory.GetInstance<IBus>(); }
public MicrosoftDependencyContainer(IServiceCollection services, IDependencyResolutionConfiguration configuration, IDependencyTypeActivator activator, IDependencyFactory dependencyFactory) : base(configuration, activator, dependencyFactory) { _services = services ?? throw new ArgumentNullException(nameof(services)); }
public ClientDetailsREST(IDependencyFactory dependencyFactory) { //TODO: move this to an app setting _restClient = dependencyFactory.GetNamedInstance<IRestClient> ("ClientDetailsServices"); // ObjectFactory.GetNamedInstance<IRestClient>("ClientDetailsServices"); }
protected override void OnRegisterFactorySingleton(IDependencyFactoryInfo info, IDependencyFactory factory) { if (info.IsFactoryGeneric()) { } else { foreach (var resolveType in info.ResolvedTypes) { _services.AddSingleton(resolveType, p => factory.Resolve(info.CreateContext(Ioc.Container))); } } base.OnRegisterFactorySingleton(info, factory); }
public LinkedFactory(Type type, IDependencyFactory factory, object serviceKey, Substitution substitution) : base(type, serviceKey, substitution) { _factory = factory; }
public ChecklistService(IDependencyFactory dependencyFactory) { _checklistRepository = dependencyFactory.GetInstance<ICheckListRepository>(); _userForAuditingRepository = dependencyFactory.GetInstance<IUserForAuditingRepository>(); _clientDocumentationChecklistPdfWriter = dependencyFactory.GetInstance<IClientDocumentationChecklistPdfWriter>(); }
/// <summary> /// /// </summary> public QaAdvisorController(IDependencyFactory dependencyFactory) { _qaAdvisorRepository = dependencyFactory.GetInstance<IQaAdvisorRepository>(); _qualityControlService = dependencyFactory.GetInstance<IQualityControlService>(); }
protected BaseTask(IDependencyFactory dependencyFactory, LiquidityEngine engine) { ExecuteAtTime = dependencyFactory.DateTimeProvider.Now; DependencyFactory = dependencyFactory; Engine = engine; }
public void TFromChanges_UpdatesTopLevelDependencies() { const string projectPath = @"c:\somefolder\someproject\a.csproj"; var targetFramework = new TargetFramework("tfm1"); var dependencyTopPrevious = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\topdependency1"", ""Name"": ""TopDependency1"", ""Caption"": ""TopDependency1"", ""SchemaItemType"": ""Xxx"", ""Resolved"": ""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyModelTopAdded = IDependencyModelFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""topdependency1"", ""Name"": ""TopDependency1"", ""Caption"": ""TopDependency1"", ""SchemaItemType"": ""Xxx"", ""Resolved"": ""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyTopUpdated = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\topdependency1"", ""Name"": ""TopDependency1"", ""Caption"": ""TopDependency1"", ""SchemaItemType"": ""Xxx"", ""Resolved"": ""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var catalogs = IProjectCatalogSnapshotFactory.Create(); var previousSnapshot = ITargetedDependenciesSnapshotFactory.Implement( projectPath: projectPath, targetFramework: targetFramework, catalogs: catalogs, dependenciesWorld: new[] { dependencyTopPrevious }, topLevelDependencies: new[] { dependencyTopPrevious }); var changes = new DependenciesChangesBuilder(); changes.Added(dependencyModelTopAdded); var snapshotFilter = new TestDependenciesSnapshotFilter() .BeforeAddAccept(@"tfm1\xxx\topdependency1", dependencyTopUpdated); var snapshot = TargetedDependenciesSnapshot.FromChanges( projectPath, previousSnapshot, changes.Build(), catalogs, ImmutableArray.Create <IDependenciesSnapshotFilter>(snapshotFilter), new Dictionary <string, IProjectDependenciesSubTreeProvider>(), null); Assert.NotSame(previousSnapshot, snapshot); Assert.Same(dependencyTopUpdated, snapshot.TopLevelDependencies.Single()); }
/// <summary> /// Creates the specified t1. /// </summary> /// <typeparam name="TOut">The type of the out.</typeparam> /// <typeparam name="T1">The type of the 1.</typeparam> /// <typeparam name="T2">The type of the 2.</typeparam> /// <param name="dependencyFactory">The dependency factory.</param> /// <param name="t1">The t1.</param> /// <param name="t2">The t2.</param> /// <returns></returns> public static TOut Create <TOut, T1, T2>(this IDependencyFactory dependencyFactory, object t1, object t2) { return(dependencyFactory.Resolve <TOut>(new ResolveParameter <T1>(t1), new ResolveParameter <T2>(t2))); }
public void TFromChanges_ReportedChangesAfterBeforeAddFilterDeclinedChange() { const string projectPath = @"c:\somefolder\someproject\a.csproj"; var targetFramework = new TargetFramework("tfm1"); var dependencyTop1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\topdependency1"", ""Name"":""TopDependency1"", ""Caption"":""TopDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyChild1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\childdependency1"", ""Name"":""ChildDependency1"", ""Caption"":""ChildDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyModelNew1 = IDependencyModelFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""newdependency1"", ""Name"":""NewDependency1"", ""Caption"":""NewDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var catalogs = IProjectCatalogSnapshotFactory.Create(); var previousSnapshot = ITargetedDependenciesSnapshotFactory.Implement( projectPath: projectPath, targetFramework: targetFramework, catalogs: catalogs, dependenciesWorld: new [] { dependencyTop1, dependencyChild1 }, topLevelDependencies: new [] { dependencyTop1 }); var changes = new DependenciesChangesBuilder(); changes.Added(dependencyModelNew1); var filterAddedDependency = new TestDependency { Id = "unexpected", TopLevel = true }; var snapshotFilter = new TestDependenciesSnapshotFilter() .BeforeAddReject(@"tfm1\xxx\newdependency1", addOrUpdate: filterAddedDependency); var snapshot = TargetedDependenciesSnapshot.FromChanges( projectPath, previousSnapshot, changes.Build(), catalogs, ImmutableArray.Create <IDependenciesSnapshotFilter>(snapshotFilter), new Dictionary <string, IProjectDependenciesSubTreeProvider>(), null); Assert.NotSame(previousSnapshot, snapshot); Assert.Same(previousSnapshot.TargetFramework, snapshot.TargetFramework); Assert.Same(previousSnapshot.ProjectPath, snapshot.ProjectPath); Assert.Same(previousSnapshot.Catalogs, snapshot.Catalogs); AssertEx.CollectionLength(snapshot.TopLevelDependencies, 2); Assert.Contains(dependencyTop1, snapshot.TopLevelDependencies); Assert.Contains(filterAddedDependency, snapshot.TopLevelDependencies); AssertEx.CollectionLength(snapshot.DependenciesWorld, 3); Assert.Contains(dependencyTop1, snapshot.DependenciesWorld.Values); Assert.Contains(dependencyChild1, snapshot.DependenciesWorld.Values); Assert.Contains(filterAddedDependency, snapshot.DependenciesWorld.Values); }
/// <summary> /// Creates the specified dependency factory. /// </summary> /// <typeparam name="TOut">The type of the out.</typeparam> /// <param name="dependencyFactory">The dependency factory.</param> /// <returns></returns> public static TOut Create <TOut>(this IDependencyFactory dependencyFactory) { return(dependencyFactory.Resolve <TOut>()); }
public void AddFactory(IDependencyFactory factory) { _factories.Add(factory); }
private void MapDependencies(IDependencyFactory factory) { factory.Map <ILogger, ConsoleLogger>(); factory.Map <OutputFormatter, Formatter>(); }
/// <summary> /// /// </summary> public QaAdvisorController(IDependencyFactory dependencyFactory) { _qaAdvisorRepository = dependencyFactory.GetInstance<IQaAdvisorRepository>(); }
public ConsultantController(IDependencyFactory dependencyFactory) { _consultantRepository = dependencyFactory.GetInstance<IConsultantRepository>(); _activeDirectoryService = dependencyFactory.GetInstance<IActiveDirectoryService>(); // new ActiveDirectoryService("HQ", "DC=hq,DC=peninsula-uk,DC=local", @"hq\veritas", "is74rb80pk52"); _userForAuditingRepository = dependencyFactory.GetInstance<BusinessSafe.Domain.RepositoryContracts.IUserForAuditingRepository>(); }
/// <summary> /// Creates the specified name. /// </summary> /// <typeparam name="TOut">The type of the out.</typeparam> /// <param name="dependencyFactory">The dependency factory.</param> /// <param name="name">The name.</param> /// <returns></returns> public static TOut Create <TOut>(this IDependencyFactory dependencyFactory, string name) { return(dependencyFactory.Resolve <TOut>(name)); }
public void TFromChanges_RemovedAndAddedChanges() { const string projectPath = @"c:\somefolder\someproject\a.csproj"; var targetFramework = new TargetFramework("tfm1"); var dependencyTop1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\topdependency1"", ""Name"":""TopDependency1"", ""Caption"":""TopDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyChild1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\childdependency1"", ""Name"":""ChildDependency1"", ""Caption"":""ChildDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyModelAdded1 = IDependencyModelFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""addeddependency1"", ""Name"":""AddedDependency1"", ""Caption"":""AddedDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyModelAdded2 = IDependencyModelFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""addeddependency2"", ""Name"":""AddedDependency2"", ""Caption"":""AddedDependency2"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyModelAdded3 = IDependencyModelFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""addeddependency3"", ""Name"":""AddedDependency3"", ""Caption"":""AddedDependency3"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyAdded2Changed = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\addeddependency2"", ""Name"":""AddedDependency2Changed"", ""Caption"":""AddedDependency2Changed"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""true"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyRemoved1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\Removeddependency1"", ""Name"":""RemovedDependency1"", ""Caption"":""RemovedDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); var dependencyInsteadRemoved1 = IDependencyFactory.FromJson(@" { ""ProviderType"": ""Xxx"", ""Id"": ""tfm1\\xxx\\InsteadRemoveddependency1"", ""Name"":""InsteadRemovedDependency1"", ""Caption"":""InsteadRemovedDependency1"", ""SchemaItemType"":""Xxx"", ""Resolved"":""true"", ""TopLevel"":""false"" }", icon: KnownMonikers.Uninstall, expandedIcon: KnownMonikers.Uninstall); Assert.True(dependencyTop1.TopLevel); Assert.False(dependencyChild1.TopLevel); Assert.False(dependencyRemoved1.TopLevel); var catalogs = IProjectCatalogSnapshotFactory.Create(); var previousSnapshot = ITargetedDependenciesSnapshotFactory.Implement( projectPath: projectPath, targetFramework: targetFramework, catalogs: catalogs, dependenciesWorld: new [] { dependencyTop1, dependencyChild1, dependencyRemoved1 }, topLevelDependencies: new [] { dependencyTop1 }); var changes = new DependenciesChangesBuilder(); changes.Added(dependencyModelAdded1); changes.Added(dependencyModelAdded2); changes.Added(dependencyModelAdded3); changes.Removed("Xxx", "Removeddependency1"); var snapshotFilter = new TestDependenciesSnapshotFilter() .BeforeAddReject(@"tfm1\xxx\addeddependency1") .BeforeAddAccept(@"tfm1\xxx\addeddependency2", dependencyAdded2Changed) .BeforeAddAccept(@"tfm1\xxx\addeddependency3") .BeforeRemoveAccept(@"tfm1\xxx\Removeddependency1", dependencyInsteadRemoved1); var snapshot = TargetedDependenciesSnapshot.FromChanges( projectPath, previousSnapshot, changes.Build(), catalogs, ImmutableArray.Create <IDependenciesSnapshotFilter>(snapshotFilter), new Dictionary <string, IProjectDependenciesSubTreeProvider>(), null); Assert.NotSame(previousSnapshot, snapshot); Assert.Same(previousSnapshot.TargetFramework, snapshot.TargetFramework); Assert.Same(projectPath, snapshot.ProjectPath); Assert.Same(catalogs, snapshot.Catalogs); AssertEx.CollectionLength(snapshot.TopLevelDependencies, 2); Assert.Contains(snapshot.TopLevelDependencies, x => x.Id.Equals(@"tfm1\xxx\topdependency1")); Assert.Contains(snapshot.TopLevelDependencies, x => x.Id.Equals(@"tfm1\xxx\addeddependency2") && x.Caption.Equals("AddedDependency2Changed")); AssertEx.CollectionLength(snapshot.DependenciesWorld, 5); Assert.True(snapshot.DependenciesWorld.ContainsKey(@"tfm1\xxx\topdependency1")); Assert.True(snapshot.DependenciesWorld.ContainsKey(@"tfm1\xxx\childdependency1")); Assert.True(snapshot.DependenciesWorld.ContainsKey(@"tfm1\xxx\addeddependency2")); Assert.True(snapshot.DependenciesWorld.ContainsKey(@"tfm1\xxx\InsteadRemoveddependency1")); Assert.True(snapshot.DependenciesWorld.ContainsKey(@"tfm1\xxx\addeddependency3")); }
/// <summary> /// Creates the specified name. /// </summary> /// <typeparam name="TOut">The type of the out.</typeparam> /// <typeparam name="T1">The type of the 1.</typeparam> /// <param name="dependencyFactory">The dependency factory.</param> /// <param name="name">The name.</param> /// <param name="t1">The t1.</param> /// <returns></returns> public static TOut Create <TOut, T1>(this IDependencyFactory dependencyFactory, string name, object t1) { return(dependencyFactory.Resolve <TOut>(name, new ResolveParameter <T1>(t1))); }
public void UnsupportedProjectsSnapshotFilter_WhenDependencyNotRecognized_ShouldDoNothing() { var aggregateSnapshotProvider = IAggregateDependenciesSnapshotProviderFactory.Create(); var targetFRameworkProvider = ITargetFrameworkProviderFactory.Create(); var dependency = IDependencyFactory.Implement( id: "mydependency1", topLevel: false); var topLevelDependency = IDependencyFactory.Implement( id: "mydependency2", topLevel: true, resolved: false); var topLevelResolvedDependency = IDependencyFactory.Implement( id: "mydependency3", topLevel: true, resolved: true, flags: ProjectTreeFlags.Empty); var topLevelResolvedSharedProjectDependency = IDependencyFactory.Implement( id: "mydependency4", topLevel: true, resolved: true, flags: DependencyTreeFlags.ProjectNodeFlags.Union(DependencyTreeFlags.SharedProjectFlags)); var worldBuilder = new Dictionary <string, IDependency>() { { dependency.Object.Id, dependency.Object }, { topLevelDependency.Object.Id, topLevelDependency.Object }, { topLevelResolvedDependency.Object.Id, topLevelResolvedDependency.Object }, { topLevelResolvedSharedProjectDependency.Object.Id, topLevelResolvedSharedProjectDependency.Object }, }.ToImmutableDictionary().ToBuilder(); var filter = new UnsupportedProjectsSnapshotFilter(aggregateSnapshotProvider, targetFRameworkProvider); var resultDependency = filter.BeforeAdd( null, null, dependency.Object, worldBuilder, null, out bool filterAnyChanges); resultDependency = filter.BeforeAdd( null, null, topLevelDependency.Object, worldBuilder, null, out bool filterAnyChanges2); resultDependency = filter.BeforeAdd( null, null, topLevelResolvedDependency.Object, worldBuilder, null, out bool filterAnyChanges3); resultDependency = filter.BeforeAdd( null, null, topLevelResolvedSharedProjectDependency.Object, worldBuilder, null, out bool filterAnyChanges4); dependency.VerifyAll(); topLevelDependency.VerifyAll(); }