public object Resolve(Castle.MicroKernel.Context.CreationContext context, ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency) { //resolve your connectionstring here }
public bool CanResolve( Castle.MicroKernel.Context.CreationContext context, ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency) { return(dependency.TargetType == typeof(StringConfiguration)); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { if (HttpContext.Current != null && (bool)initialized.GetValue(null)) { return(webRequestScopeAccessor.GetScope(context)); } return(secondaryScopeAccessor.GetScope(context)); }
protected override object CreateInstance(Castle.MicroKernel.Context.CreationContext context, Castle.Core.ConstructorCandidate constructor, object[] arguments) { var component = base.CreateInstance(context, constructor, arguments); AssignViewModel(component, arguments); return(component); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { if (HttpContext.Current != null && PerWebRequestLifestyleModuleUtils.IsInitialized) { return(webRequestScopeAccessor.GetScope(context)); } return(secondaryScopeAccessor.GetScope(context)); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { int key = GetContextKey(context); if (!Cache.ContainsKey(key)) { Cache.Add(key, new DefaultLifetimeScope()); } return(Cache[key]); }
private int GetContextKey(Castle.MicroKernel.Context.CreationContext context) { int hash = 0; foreach (var value in context.AdditionalArguments.Values) { hash = HashCode.CombineHashCode(hash, value.GetHashCode()); } return(hash); }
public object Resolve( Castle.MicroKernel.Context.CreationContext context, ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency) { var configuration = ConfigurationServiceClient.Instance.GetSetting(dependency.DependencyKey); return(new StringConfiguration() { Value = configuration, }); }
public override object Create(Castle.MicroKernel.Context.CreationContext context, Burden burden) { Console.WriteLine(burden); //return null; if (Enable) { //burden.SetRootInstance(f); return(base.Create(context, burden)); } else { return(null); } }
public override object Resolve(Castle.MicroKernel.Context.CreationContext context, Castle.MicroKernel.IReleasePolicy releasePolicy) { var param = context.AdditionalArguments["model"]; if (this._instances.Keys.Contains(param)) { return(this._instances[param]); } var instanceVm = base.Resolve(context, releasePolicy); if (instanceVm is IDataEntityVm) // only IDataEntityVm VMs are bound per entity... other constructors are not { var instance = instanceVm as IDataEntityVm; this._instances.TryAdd(param, instance); //no need for concurrency check } return(instanceVm); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { return(new DefaultLifetimeScope()); }
public object Resolve(Castle.MicroKernel.Context.CreationContext context, ISubDependencyResolver contextHandlerResolver, Castle.Core.ComponentModel model, Castle.Core.DependencyModel dependency) { throw new NotImplementedException(); }
protected override object Instantiate(Castle.MicroKernel.Context.CreationContext context) { return(context.AdditionalArguments.Contains(Key) ? context.AdditionalArguments[Key] : base.Instantiate(context)); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { return(GetHttpModule().GetScope()); }
public ILifetimeScope GetScope(Castle.MicroKernel.Context.CreationContext context) { return(accessors.Select(a => a.GetScope(context)).FirstOrDefault(s => s != null)); }