예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
        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();
        }
예제 #4
0
        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);
예제 #6
0
 public NestStartupTest(Dependency2 dependency) => Dependency = dependency;
예제 #7
0
 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);
예제 #9
0
 public void DoSomethingElse(Dependency2 d)
 {
     d.DoSomethingElse();
 }
 public DependencyDependedOn_Dependency2(Dependency2 dependency)
 {
     Dependency2 = dependency;
 }
예제 #11
0
 public ParentWithMultipleCtor(Dependency1 d1, Dependency2 d2)
 {
 }
    public void DoSomething()
    {
        var dependency = new Dependency2();

        dependeny.DoSomethingElse();
    }
예제 #13
0
 public Parent(Dependency1 d1, Dependency2 d2)
 {
     D1 = d1;
     D2 = d2;
 }
예제 #14
0
 public void DoSomethingElse(Dependency2 d)
 {
     // var d = new Dependency2();
     d.DoSomethingElse();
 }
예제 #15
0
 public void Construct(Dependency1 dependency1, Dependency2 dependency2)
 {
     _dependency1 = dependency1;
     _dependency2 = dependency2;
 }
예제 #16
0
 public ServiceLocatorClient(ServiceContainer container)
 {
     Dependency1 = container.GetInstance <Dependency1>();
     Dependency2 = container.GetInstance <Dependency2>();
 }
예제 #17
0
 public ConstructorInjectionClient(Dependency1 dependency1, Dependency2 dependency2)
 {
     Dependency1 = dependency1.MustNotBeNull();
     Dependency2 = dependency2.MustNotBeNull();
 }
예제 #18
0
 public ParentWithOnePublicCtor(Dependency1 d1, Dependency2 d2)
 {
     D1 = d1;
     D2 = d2;
 }
 public ResolvedSingleton(Dependency1 dependency1, Dependency2 dependency2)
 {
 }
예제 #20
0
 public Dependency3(Dependency1 dependency1, Dependency2 dependency2)
 {
     Dependency1 = dependency1;
     Dependency2 = dependency2;
 }
예제 #21
0
 public void Construct(Dependency1 dependency1, Dependency2 dependency2, Dependency3 dependency3)
 {
     _dependency1 = dependency1;
     _dependency2 = dependency2;
     _dependency3 = dependency3;
 }
예제 #22
0
 public StartupAttributeTest(Dependency2 dependency) => Dependency = dependency;
예제 #23
0
 public Dependency1(Dependency2 dep2)
 {
 }
예제 #24
0
 public Dependency1(Dependency2 d2)
 {
 }
예제 #25
0
 public void Construct(Dependency2 dependency)
 {
     _dependency = dependency;
 }