예제 #1
0
        /// <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;
            }
        }
예제 #2
0
 public IEnumerable <TExtension> GetExtensions <TExtension>(Expression <Func <IEnumerable <TExtension> > > propertyExpresion, Func <IProduct, TExtension> productProxyFactory)
     where TExtension : class
 {
     return(ToolkitInterfaceLayer.GetExtensions(this.container, propertyExpresion, productProxyFactory));
 }
예제 #3
0
 public IEnumerable <TElement> GetElements <TElement>(Expression <Func <IEnumerable <TElement> > > propertyExpresion, Func <IAbstractElement, TElement> elementProxyFactory)
     where TElement : class
 {
     return(ToolkitInterfaceLayer.GetElements(this.container, propertyExpresion, elementProxyFactory));
 }
예제 #4
0
 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));
 }
예제 #5
0
 public TCollection CreateCollection <TCollection>(string name, Action <TCollection> initializer = null, bool raiseInstantiateEvents = true)
     where TCollection : class
 {
     return(ToolkitInterfaceLayer.CreateCollection(this.container, name, initializer, raiseInstantiateEvents));
 }
예제 #6
0
 public TElement CreateElement <TElement>(string name, Action <TElement> initializer = null, bool raiseInstantiateEvents = true)
     where TElement : class
 {
     return(ToolkitInterfaceLayer.CreateElement(this.container, name, initializer, raiseInstantiateEvents));
 }
예제 #7
0
 public void SetValue <TProperty>(Expression <Func <TProperty> > propertyExpresion, TProperty value)
 {
     ToolkitInterfaceLayer.SetValue <TInterface, TProperty>(this.element, propertyExpresion, value);
 }
예제 #8
0
 public TProperty GetValue <TProperty>(Expression <Func <TProperty> > propertyExpresion)
 {
     return(ToolkitInterfaceLayer.GetValue <TInterface, TProperty>(this.element, propertyExpresion));
 }
예제 #9
0
 public TView GetView <TView>(Expression <Func <TView> > propertyExpresion, Func <IView, TView> viewProxyFactory)
     where TView : class
 {
     return(ToolkitInterfaceLayer.GetView <TInterface, TView>(this.product, propertyExpresion, viewProxyFactory));
 }