private static void ExtractProperties <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            List <PropertyInfo> properties = cachedTypePropertyDic[extractObj.GetType()][ContextUsage.Extract];

            if (properties != null && properties.Count > 0)
            {
                foreach (var property in properties)
                {
                    if (typeof(IContextContainer <>).IsAssignableFrom(property.PropertyType))
                    {
                        throw new InvalidOperationException("Context can only be used with the InjectUsage.In option.");
                    }

                    var    attr       = property.GetCustomAttribute <ContextIEAttribute>();
                    object fieldValue = property.GetValue(extractObj);
                    if (!attr.Optional)
                    {
                        context.AddOrUpdate((K)attr.Key, fieldValue);
                    }
                    else if (fieldValue != null)
                    {
                        context.AddOrUpdate((K)attr.Key, fieldValue);
                    }
                }
            }
        }
 public ProductManager(IContextContainer container)
     : base(container)
 {
     _productDAO = new ProductDAO(container);
     _categoryDAO = new CategoryDAO(container);
     _attributeDAO = new AttributeDAO(container);
 }
 public ProductManager(IContextContainer container)
     : base(container)
 {
     _productDAO   = new ProductDAO(container);
     _categoryDAO  = new CategoryDAO(container);
     _attributeDAO = new AttributeDAO(container);
 }
        private static void ExtractFields <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            List <FieldInfo> fields = cachedTypeFieldDic[extractObj.GetType()][ContextUsage.Extract];

            if (fields != null && fields.Count > 0)
            {
                foreach (var field in fields)
                {
                    if (typeof(IContextContainer <>).IsAssignableFrom(field.FieldType))
                    {
                        throw new InvalidOperationException("Context can only be used with the InjectUsage.In option.");
                    }

                    var    attr  = field.GetCustomAttribute <ContextIEAttribute>();
                    object value = field.GetValue(extractObj);
                    if (!attr.Optional)
                    {
                        context.AddOrUpdate((K)attr.Key, value);
                    }
                    else if (value != null)
                    {
                        context.AddOrUpdate((K)attr.Key, value);
                    }
                }
            }
        }
 public PaymentManager(IContextContainer container)
     : base(container)
 {
     _paypalPaymentDAO  = new PaypalPaymentDAO(container);
     _easyPayPaymentDAO = new EasyPayPaymentDAO(container);
     _cashPaymentDAO    = new CashPaymentDAO(container);
     _paymentDAO        = new PaymentDAO(container);
     _currencyDAO       = new CurrencyDAO(container);
 }
 public PaymentManager(IContextContainer container)
     : base(container)
 {
     _paypalPaymentDAO = new PaypalPaymentDAO(container);
     _easyPayPaymentDAO = new EasyPayPaymentDAO(container);
     _cashPaymentDAO = new CashPaymentDAO(container);
     _paymentDAO = new PaymentDAO(container);
     _currencyDAO = new CurrencyDAO(container);
 }
 public OrderManager(IContextContainer container)
     : base(container)
 {
     _orderDAO       = new OrderDAO(container);
     _productDAO     = new ProductDAO(container);
     _bonusDAO       = new BonusDAO(container);
     _cartDAO        = new ShoppingCartDAO(container);
     _addressInfoDAO = new AddressInfoDAO(container);
     _customerDAO    = new CustomerDAO(container);
 }
 public OrderManager(IContextContainer container)
     : base(container)
 {
     _orderDAO = new OrderDAO(container);
     _productDAO = new ProductDAO(container);
     _bonusDAO = new BonusDAO(container);
     _cartDAO = new ShoppingCartDAO(container);
     _addressInfoDAO = new AddressInfoDAO(container);
     _customerDAO = new CustomerDAO(container);
 }
 public ContextContainer()
 {
     if (HttpContext.Current == null)
     {
         _container = new ThreadContextContainer();
     }
     else
     {
         _container = new WebContextContainer();
     }
 }
        private static void InjectFields <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            List <FieldInfo> fields = cachedTypeFieldDic[injectObj.GetType()][ContextUsage.Inject];

            if (fields != null && fields.Count > 0)
            {
                foreach (var field in fields)
                {
                    var attr = field.GetCustomAttribute <ContextIEAttribute>();

                    if (!context.TryGet((K)attr.Key, out object value))
                    {
                        if (value == null && !attr.Optional)
                        {
                            throw new ContextValueNullException(attr.Key);
                        }
                    }
                    field.SetValue(injectObj, value);
                }
            }
        }
        private static void InjectProperties <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            List <PropertyInfo> properties = cachedTypePropertyDic[injectObj.GetType()][ContextUsage.Inject];

            if (properties != null && properties.Count > 0)
            {
                foreach (var property in properties)
                {
                    var attr = property.GetCustomAttribute <ContextIEAttribute>();

                    if (!context.TryGet((K)attr.Key, out object value))
                    {
                        if (value == null && !attr.Optional)
                        {
                            throw new ContextValueNullException(attr.Key);
                        }
                    }
                    property.SetValue(injectObj, value);
                }
            }
        }
        public static void Inject <K>(IContextContainer <K> context, IContextObject injectObj)
        {
            if (injectObj == null || context == null)
            {
                throw new ArgumentNullException("argument is null.");
            }
            Type injectObjType = injectObj.GetType();

            if (!cachedTypeFieldDic.ContainsKey(injectObjType))
            {
                CachedFields(injectObjType);
            }

            if (!cachedTypePropertyDic.ContainsKey(injectObjType))
            {
                CachedProperties(injectObjType);
            }

            InjectFields(context, injectObj);
            InjectProperties(context, injectObj);
        }
        public static void Extract <K>(IContextContainer <K> context, IContextObject extractObj)
        {
            if (extractObj == null || context == null)
            {
                throw new ArgumentNullException("ContextUtil::Extract->argument is null");
            }

            Type extractObjType = extractObj.GetType();

            if (!cachedTypeFieldDic.ContainsKey(extractObjType))
            {
                CachedFields(extractObjType);
            }

            if (!cachedTypePropertyDic.ContainsKey(extractObjType))
            {
                CachedProperties(extractObjType);
            }

            ExtractFields(context, extractObj);
            ExtractProperties(context, extractObj);
        }
Beispiel #14
0
        private void CreateManagers()
        {
            var resourcesManagerFactory = new ResourcesManagerFactory();

            ResourcesManager = resourcesManagerFactory.Create();
            _managers.Add(ResourcesManager.Instance());

            var managerCanvasFactory = new ManagerCanvasFactory();

            ManagerCanvas = managerCanvasFactory.Create();
            _managers.Add(ManagerCanvas.Instance());

            var managerUi = new ManagerUiFactory();

            ManagerUi = managerUi.Create();
            _managers.Add(ManagerUi.Instance());

            var managerGameFactory = new ManagerGameFactory();

            ManagerGame = managerGameFactory.Create();
            _managers.Add(ManagerGame.Instance());
        }
        protected void InitializeView()
        {
            GameObject loadedObject = ObjectPoolManager.Instantiate(this._viewPrefabName);

            this._view = loadedObject.GetComponent <TView>();
            this._view.AddShowDismissEvents(this);

            CanvasUtil.ParentUIElementToCanvas(loadedObject, CanvasUtil.ScreenSpaceMainCanvas);

            IContextContainer contextContainer = this._view as IContextContainer;

            if (contextContainer == null)
            {
                Debug.LogError("InitializeView: view is not an IContextContainer, probably should be!");
            }
            else
            {
                contextContainer.ProvideContext(this);
            }

            this.OnViewInitialized();
        }
 public InvitationDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #17
0
 public AddressInfoDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #18
0
 public MovieRatingService(IContextContainer contextContainer)
 {
     _contextContainer = contextContainer;
 }
Beispiel #19
0
 public ReturnDAO(IContextContainer container)
     : base(container)
 {
 }
   public AddressInfoDAO(IContextContainer container)
     : base(container)
 {
 }
 public CategoryManager(IContextContainer container)
     : base(container)
 {
     _categoryDAO = new CategoryDAO(container);
 }
 public BaseManager(IContextContainer container)
 {
     Context = (privEntities)container.Current;
 }
 public ProductDAO(IContextContainer container)
     : base(container)
 {
 }
 public ReturnManager(IContextContainer container)
     : base(container)
 {
     _returnDAO = new ReturnDAO(container);
 }
 public AttributeDAO(IContextContainer container)
     : base(container)
 {
 }
 public CashPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 public BrandManager(IContextContainer container)
     : base(container)
 {
     _brandDAO = new BrandDAO(container);
 }
 public CurrencyDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #29
0
 public InvitationManager(IContextContainer container)
     : base(container)
 {
     _invititationDAO = new InvitationDAO(container);
 }
 protected ContextConnector(IContextContainer contextContainer)
     : this(contextContainer, false)
 {
 }
  public CashPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 public CustomerManager(IContextContainer container)
     : base(container)
 {
     _customerDAO = new CustomerDAO(container);
 }
Beispiel #33
0
 public UserDAO(IContextContainer container)
     : base(container)
 {
 }
 public ShoppingCartManager(IContextContainer container)
     : base(container)
 {
     _shoppingCartDAO = new ShoppingCartDAO(container);
     _productDAO = new ProductDAO(container);
 }
Beispiel #35
0
 public CustomerManager(IContextContainer container)
     : base(container)
 {
     _customerDAO = new CustomerDAO(container);
 }
 public EasyPayPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 protected ContextConnector(IContextContainer contextContainer, bool useBulk)
 {
     ContextContainer = contextContainer;
     UseBulk          = useBulk;
 }
 public CampaignManager(IContextContainer container)
     : base(container)
 {
     _campaignDAO = new CampaignDAO(container);
 }
 public CampaignManager(IContextContainer container)
     : base(container)
 {
     _campaignDAO = new CampaignDAO(container);
 }
 public BonusManager(IContextContainer container) : base(container)
 {
     _bonusDAO = new BonusDAO(container);
 }
 public CategoryDAO(IContextContainer container)
     : base(container)
 {
 }
 public AttributeManager(IContextContainer container)
     : base(container)
 {
     _attributeDAO = new AttributeDAO(container);
 }
 public ReturnManager(IContextContainer container)
     : base(container)
 {
     _returnDAO = new ReturnDAO(container);
 }
Beispiel #44
0
 public BrandDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #45
0
 public UnitOfWork(IContextContainer context)
 {
     ContextContainer = context;
 }
Beispiel #46
0
 public UserManager(IContextContainer container)
     : base(container)
 {
     _userDAO = new UserDAO(container);
 }
Beispiel #47
0
 public BonusDAO(IContextContainer container)
     : base(container)
 {
 }
 public CampaignDAO(IContextContainer container)
     : base(container)
 {
 }
 public PaypalPaymentDAO(IContextContainer container)
     : base(container)
 {
 }
 public UserManager(IContextContainer container)
     : base(container)
 {
     _userDAO = new UserDAO(container);
 }
 public ValidationService(IContextContainer contextContainer)
 {
     _contextContainer = contextContainer;
 }
 public ShoppingCartDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #53
0
 public ShoppingCartManager(IContextContainer container)
     : base(container)
 {
     _shoppingCartDAO = new ShoppingCartDAO(container);
     _productDAO      = new ProductDAO(container);
 }
 public AttributeManager(IContextContainer container)
     : base(container)
 {
     _attributeDAO = new AttributeDAO(container);
 }
Beispiel #55
0
 public BrandManager(IContextContainer container)
     : base(container)
 {
     _brandDAO = new BrandDAO(container);
 }
 public CustomerDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #57
0
 public BaseDAO(IContextContainer container)
 {
     Context = (privEntities)container.Current;
 }
Beispiel #58
0
 public CategoryDAO(IContextContainer container)
     : base(container)
 {
 }
Beispiel #59
0
 public CelestialObjectConnector(IContextContainer contextContainer) :
     base(contextContainer)
 {
 }
 public InvitationManager(IContextContainer container)
     : base(container)
 {
     _invititationDAO = new InvitationDAO (container);
 }