Esempio n. 1
0
 public ConstructorFrame(ConstructorInstance instance, DisposeTracking disposal, Variable[] arguments)
 {
     Disposal            = disposal;
     _arguments          = arguments;
     Variable            = new ServiceVariable(instance, this);
     _implementationType = instance.ImplementationType;
 }
Esempio n. 2
0
 public MessagingRootFrame(MessagingRootInstance <T> parent, Variable root)
 {
     _parent = parent;
     _root   = root;
     uses.Add(root);
     Service = new ServiceVariable(parent, this);
 }
Esempio n. 3
0
        public void service_variable_exposes_the_nested_container_as_a_parent()
        {
            var variable = new ServiceVariable(typeof(ScopedService), StructureMapServices.Nested);

            variable.Dependencies.Single()
            .ShouldBeSameAs(StructureMapServices.Nested);
        }
Esempio n. 4
0
        public InstanceConstructorFrame(ConstructorInstance instance, DisposeTracking disposal, Variable[] arguments,
                                        SetterArg[] setterParameters) : base(instance.ImplementationType, instance.Constructor)
        {
            Variable = new ServiceVariable(instance, this, ServiceDeclaration.ServiceType);
            Disposal = disposal;

            Parameters = arguments;

            switch (disposal)
            {
            case DisposeTracking.None:
                Mode = ConstructorCallMode.Variable;
                break;

            case DisposeTracking.WithUsing:
                Mode = ConstructorCallMode.UsingNestedVariable;
                break;

            case DisposeTracking.RegisterWithScope:
                Mode = ConstructorCallMode.Variable;
                var addDisposable = MethodCall.For <Scope>(s => s.TryAddDisposable(null));
                addDisposable.Arguments[0] = Variable;
                ActivatorFrames.Add(addDisposable);
                break;
            }

            Setters.AddRange(setterParameters);
        }
 public CallFuncBuilderFrame(ConstructorInstance instance, DisposeTracking disposal, Variable func, Variable[] arguments)
 {
     Disposal   = disposal;
     _func      = func;
     _arguments = arguments;
     Variable   = new ServiceVariable(instance, this);
 }
        public CallFuncBuilderFrame(ConstructorInstance instance, DisposeTracking disposal, Variable func, Variable[] arguments)
        {
            // HACK, and I hate this but it's necessary.
            for (int i = 0; i < arguments.Length; i++)
            {
                if (arguments[i] is OptionalArgumentVariable)
                {
                    arguments[i] = ((OptionalArgumentVariable)arguments[i]).Inner;
                }
            }

            Disposal   = disposal;
            _func      = func;
            _arguments = arguments;
            Variable   = new ServiceVariable(instance, this);
        }
Esempio n. 7
0
 public GetFuncFrame(Instance instance, Type innerType)
 {
     _serviceType = innerType;
     Variable     = new ServiceVariable(instance, this);
 }
 public SqlConnectionFrame(Variable settings, Instance instance)
 {
     _settings  = settings;
     Connection = new ServiceVariable(instance, this);
     _instance  = instance;
 }
Esempio n. 9
0
 public InlineLambdaCreationFrame(Setter setter, Instance instance)
 {
     Variable = new ServiceVariable(instance, this);
     _setter  = setter;
 }
Esempio n. 10
0
 public OpenSessionFrame(SessionInstance instance, Variable store)
 {
     Variable = new ServiceVariable(instance, this);
     uses.Add(store);
 }
Esempio n. 11
0
 public GetInjectedServiceFrame(InjectedInstance <T> parent)
 {
     Variable = new ServiceVariable(parent, this);
 }
Esempio n. 12
0
 public NewContextFrame(MessageContextInstance instance, Variable root)
 {
     _root    = root;
     Variable = new ServiceVariable(instance, this);
     uses.Add(root);
 }