public override Variable CreateInlineVariable(ResolverVariables variables) { return(new Setter(ServiceType, inlineSetterName()) { InitialValue = Service }); }
protected override Variable generateVariableForBuilding(ResolverVariables variables, BuildMode mode, bool isRoot) { // This is goofy, but if the current service is the top level root of the resolver // being created here, make the dependencies all be Dependency mode var dependencyMode = isRoot && mode == BuildMode.Build ? BuildMode.Dependency : mode; var elements = Elements.Select(x => variables.Resolve(x, dependencyMode)).ToArray(); return(new ListAssignmentFrame <T>(this, elements).Variable); }
public override Frame CreateBuildFrame() { var variables = new ResolverVariables(); var elements = _elements.Select(x => variables.Resolve(x, BuildMode.Dependency)).ToArray(); return(new ArrayAssignmentFrame <T>(this, elements) { ReturnCreated = true }); }
public Variable Resolve(ResolverVariables variables, BuildMode mode) { var variable = variables.Resolve(Instance, mode); if (Parameter.Name.EqualsIgnoreCase(variable.Usage)) { variable.OverrideName("inline_" + variable.Usage); } return(variable); }
public Variable Resolve(ResolverVariables variables, BuildMode mode) { if (Instance.IsInlineDependency()) { return(Instance.CreateInlineVariable(variables)); } var inner = variables.Resolve(Instance, mode); return(Parameter.IsOptional ? new OptionalArgumentVariable(inner, Parameter) : inner); }
private void useInlineConstruction() { var variables = new ResolverVariables(_fields); foreach (var standin in _standins) { var variable = variables.Resolve(standin.Instance, BuildMode.Inline); standin.UseInner(variable); } variables.OfType <InjectedServiceField>().Each(field => { var family = _services.FindAll(field.VariableType); field.IsOnlyOne = family.Length == 1; }); }
public sealed override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { if (Lifetime == ServiceLifetime.Singleton) { if (mode == BuildMode.Build) { return(generateVariableForBuilding(variables, mode, isRoot)); } return(new InjectedServiceField(this)); } if (Lifetime == ServiceLifetime.Scoped && mode == BuildMode.Dependency) { return(new GetInstanceFrame(this).Variable); } return(generateVariableForBuilding(variables, mode, isRoot)); }
public SetterArg Resolve(ResolverVariables variables, BuildMode mode) { Variable variable; if (Instance.IsInlineDependency()) { variable = Instance.CreateInlineVariable(variables); // HOKEY. Might need some smarter way of doing this. Helps to disambiguate // between ctor args of nested decorators if (!(variable is Setter)) { variable.OverrideName(variable.Usage + "_inline_" + ++variables.VariableSequence); } } else { variable = variables.Resolve(Instance, mode); } return(new SetterArg(Property, variable)); }
public Variable Resolve(ResolverVariables variables, BuildMode mode) { if (Instance.IsInlineDependency()) { var variable = Instance.CreateInlineVariable(variables); // HOKEY. Might need some smarter way of doing this. Helps to disambiguate // between ctor args of nested decorators if (!(variable is Setter)) { variable.OverrideName(variable.Usage + "_inline_" + ++variables.VariableSequence); } return(variable); } var inner = variables.Resolve(Instance, mode); return(Parameter.IsOptional ? new OptionalArgumentVariable(inner, Parameter) : inner); }
public abstract Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot);
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { var settings = variables.Resolve(_settings, mode); return(new SqlConnectionFrame(settings, this).Connection); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { throw new NotImplementedException(); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(new NullVariable(ServiceType)); }
public override Variable CreateInlineVariable(ResolverVariables variables) { return(_inner.CreateInlineVariable(variables)); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(new GetInjectedServiceFrame(this).Variable); }
protected abstract Variable generateVariableForBuilding(ResolverVariables variables, BuildMode mode, bool isRoot);
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { var root = variables.Resolve(_root, mode); return(new MessagingRootFrame(this, root).Service); }
public virtual Variable CreateInlineVariable(ResolverVariables variables) { return(CreateVariable(BuildMode.Dependency, variables, false)); }
protected override Variable generateVariableForBuilding(ResolverVariables variables, BuildMode mode, bool isRoot) { throw new NotImplementedException(); }
public Variable Resolve(ResolverVariables variables, BuildMode mode) { return(variables.Resolve(Instance, mode)); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(new CastScopeFrame(typeof(T)).Variable); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(new GetFuncFrame(this, typeof(T)).Variable); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(_inner.CreateVariable(mode, variables, isRoot)); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { return(new InjectedServiceField(this)); }
public override Variable CreateVariable(BuildMode mode, ResolverVariables variables, bool isRoot) { var root = variables.Resolve(_rootInstance, mode); return(new NewContextFrame(this, root).Variable); }