예제 #1
0
파일: Proposal.cs 프로젝트: bradstiff/sales
 private IProductScope GetProduct(ProductType productType)
 {
     if (_productGetters == null)
     {
         _productGetters = ProductType
                           .GetAll <ProductType>()
                           .Select(pt => new
         {
             ProductType = pt,
             Getter      = pt.Selector.ToGetter()
         })
                           .ToDictionary(x => x.ProductType, x => x.Getter);
     }
     return(_productGetters[productType](this));
 }
예제 #2
0
파일: Proposal.cs 프로젝트: bradstiff/sales
 private void SetProduct(ProductType productType, IProductScope product)
 {
     if (_productSetters == null)
     {
         _productSetters = ProductType
                           .GetAll <ProductType>()
                           .Select(pt => new
         {
             ProductType = pt,
             Setter      = pt.Selector.ToSetter()
         })
                           .ToDictionary(x => x.ProductType, x => x.Setter);
     }
     _productSetters[productType](this, product);
 }
예제 #3
0
파일: Proposal.cs 프로젝트: bradstiff/sales
 private IProductScope NewProduct(ProductType productType)
 {
     if (_productConstructors == null)
     {
         _productConstructors = ProductType
                                .GetAll <ProductType>()
                                .Select(pt => new
         {
             ProductType = pt,
             Constructor = ExpressionUtils.CreateDefaultConstructor <IProductScope>(pt.Type)
         })
                                .ToDictionary(x => x.ProductType, x => x.Constructor);
     }
     return(_productConstructors[productType]());
 }