/// <summary> /// Gets a strong typed interface layer for a pattern. /// </summary> public static TInterface As <TInterface>(this IInstanceBase instance) { Guard.NotNull(() => instance, instance); if (resolvingInstanceBaseAs.Value.GetValueOrDefault()) { throw new InvalidOperationException(String.Format( CultureInfo.CurrentCulture, Resources.ToolkitInterfaceLayer_InstanceTypeDoesNotHaveInterfaceLayer, instance.GetType())); } dynamic dynInstance = instance; resolvingInstanceBaseAs.Value = true; try { return((TInterface)ToolkitInterfaceLayer.As <TInterface>(dynInstance)); } finally { resolvingInstanceBaseAs.Value = null; } }
public IEnumerable <TExtension> GetExtensions <TExtension>(Expression <Func <IEnumerable <TExtension> > > propertyExpresion, Func <IProduct, TExtension> productProxyFactory) where TExtension : class { return(ToolkitInterfaceLayer.GetExtensions(this.container, propertyExpresion, productProxyFactory)); }
public IEnumerable <TElement> GetElements <TElement>(Expression <Func <IEnumerable <TElement> > > propertyExpresion, Func <IAbstractElement, TElement> elementProxyFactory) where TElement : class { return(ToolkitInterfaceLayer.GetElements(this.container, propertyExpresion, elementProxyFactory)); }
public TExtension CreateExtension <TExtension>(string name, Guid productId, string toolkitId, Action <TExtension> initializer = null, bool raiseInstantiateEvents = true) where TExtension : class { return(ToolkitInterfaceLayer.CreateExtension(this.container, name, productId, toolkitId, initializer, raiseInstantiateEvents)); }
public TCollection CreateCollection <TCollection>(string name, Action <TCollection> initializer = null, bool raiseInstantiateEvents = true) where TCollection : class { return(ToolkitInterfaceLayer.CreateCollection(this.container, name, initializer, raiseInstantiateEvents)); }
public TElement CreateElement <TElement>(string name, Action <TElement> initializer = null, bool raiseInstantiateEvents = true) where TElement : class { return(ToolkitInterfaceLayer.CreateElement(this.container, name, initializer, raiseInstantiateEvents)); }
public void SetValue <TProperty>(Expression <Func <TProperty> > propertyExpresion, TProperty value) { ToolkitInterfaceLayer.SetValue <TInterface, TProperty>(this.element, propertyExpresion, value); }
public TProperty GetValue <TProperty>(Expression <Func <TProperty> > propertyExpresion) { return(ToolkitInterfaceLayer.GetValue <TInterface, TProperty>(this.element, propertyExpresion)); }
public TView GetView <TView>(Expression <Func <TView> > propertyExpresion, Func <IView, TView> viewProxyFactory) where TView : class { return(ToolkitInterfaceLayer.GetView <TInterface, TView>(this.product, propertyExpresion, viewProxyFactory)); }