public void RegisterTypeWithDependency() { var cb = new ContainerBuilder(); var dependency1 = new Dependency1(); var dependency2 = new Dependency2(); cb.Register(_ => dependency1); cb.Register(_ => dependency2); cb.RegisterType <Parent>(); IComponentContext container = cb.Build(); var parent = container.Resolve <Parent>(); Assert.Equal(dependency1, parent.D1); Assert.Equal(dependency2, parent.D2); }
public ExampleClass( long startId, long endId, bool reverse, int loadIdsLimit, long maxBufferSize, CancellationTokenSource cancellationTokenSource, Dependency1 dependency1, Dependency2 dependency2) { StartId = startId; EndId = endId; Reverse = reverse; LoadIdsLimit = loadIdsLimit; MaxBufferSize = maxBufferSize; CancellationTokenSource = cancellationTokenSource; Dependency1 = dependency1; Dependency2 = dependency2; }
static void Main(string[] args) { ContainerBuilder buider = new ContainerBuilder(); buider.RegisterType <Logger>().As <ILogger>(); buider.RegisterType <Dependency>().AsSelf(); var container = buider.Build(); var logger = container.Resolve <ILogger>(); logger.Talk(); var newDependency = new Dependency2(); using (var scope = container.BeginLifetimeScope( builder => { builder.RegisterInstance(newDependency); })) { var childDependency = scope.Resolve <Dependency2>(); childDependency.Progress(); } Console.ReadLine(); }
public void AfterUnlock() { if (unlock) { //installer implementation var dependency = new FileHandler("Dependency2.cs"); //dependency.FileWrite(Strings.encrypted); //string fromFile = dependency.GetContents(); //char[] decryptFromFile = decrypt.RemoveSharedLayer1(Conversion.StringToChar(fromFile)); //char[] decryptFromFile2 = decrypt.RemovePrivateLayer2(decryptFromFile, 3); dependency.FileWrite(Client.Strings.dependency2Content); //SystemHandler.RestartSystem("path"); SystemHandler.SetDependency(Dependency2.NewDependency()); //dependency.DeleteFile(); } else { softwareLock.NetworkNotify("error"); } }
protected abstract IBaseServce <TEntity> Create(Dependency1 d1, Dependency2 d2);
public NestStartupTest(Dependency2 dependency) => Dependency = dependency;
public SomeTask(IFakeDbContext fakeDbContext, Dependency1 dependency1, Dependency2 dependency2) { FakeDbContext = fakeDbContext; Dependency1 = dependency1; Dependency2 = dependency2; }
// "arg1, arg2" protected override IBaseService <CustomEntity> Create(Dependency1 d1, Dependency2 d2) => new BaseService <CustomerEntity>(d1, d2);
public void DoSomethingElse(Dependency2 d) { d.DoSomethingElse(); }
public DependencyDependedOn_Dependency2(Dependency2 dependency) { Dependency2 = dependency; }
public ParentWithMultipleCtor(Dependency1 d1, Dependency2 d2) { }
public void DoSomething() { var dependency = new Dependency2(); dependeny.DoSomethingElse(); }
public Parent(Dependency1 d1, Dependency2 d2) { D1 = d1; D2 = d2; }
public void DoSomethingElse(Dependency2 d) { // var d = new Dependency2(); d.DoSomethingElse(); }
public void Construct(Dependency1 dependency1, Dependency2 dependency2) { _dependency1 = dependency1; _dependency2 = dependency2; }
public ServiceLocatorClient(ServiceContainer container) { Dependency1 = container.GetInstance <Dependency1>(); Dependency2 = container.GetInstance <Dependency2>(); }
public ConstructorInjectionClient(Dependency1 dependency1, Dependency2 dependency2) { Dependency1 = dependency1.MustNotBeNull(); Dependency2 = dependency2.MustNotBeNull(); }
public ParentWithOnePublicCtor(Dependency1 d1, Dependency2 d2) { D1 = d1; D2 = d2; }
public ResolvedSingleton(Dependency1 dependency1, Dependency2 dependency2) { }
public Dependency3(Dependency1 dependency1, Dependency2 dependency2) { Dependency1 = dependency1; Dependency2 = dependency2; }
public void Construct(Dependency1 dependency1, Dependency2 dependency2, Dependency3 dependency3) { _dependency1 = dependency1; _dependency2 = dependency2; _dependency3 = dependency3; }
public StartupAttributeTest(Dependency2 dependency) => Dependency = dependency;
public Dependency1(Dependency2 dep2) { }
public Dependency1(Dependency2 d2) { }
public void Construct(Dependency2 dependency) { _dependency = dependency; }