コード例 #1
0
 public bool HasStateChanged(DependencyState establishedState)
 {
     // Delegate down to all managers, returning the first non-null result
     return(Managers
            .Select(manager => manager.HasStateChanged(establishedState))
            .Where(stateChanged => stateChanged != null)
            .FirstOrDefault()
            ?? true);
 }
コード例 #2
0
ファイル: QueryDependency.cs プロジェクト: giagiigi/WE
        public bool?HasStateChanged(DependencyState establishedState)
        {
            if (!(establishedState.Context is QueryDependencyStateContext))
            {
                return(null);
            }

            var currentState = GetState((QueryDependencyStateContext)establishedState.Context);
            var stateChanged = currentState.State != establishedState.State;

            if (stateChanged && AppConfigProvider.GetAppConfigValue <bool>("ObjectCacheDebuggingEnabled"))
            {
                Debug.WriteLine(string.Format(
                                    "ObjCache - Query Changed - {0}",
                                    ((QueryDependencyStateContext)establishedState.Context).Query));
            }

            return(stateChanged);
        }
        public bool?HasStateChanged(DependencyState establishedState)
        {
            if (!(establishedState.Context is CheckoutShippingSelectionDependencyStateContext))
            {
                return(null);
            }

            var currentState = GetState(establishedState.Context);
            var stateChanged = currentState.State != establishedState.State;

            if (stateChanged && AppConfigProvider.GetAppConfigValue <bool>("ObjectCacheDebuggingEnabled"))
            {
                Debug.WriteLine(string.Format(
                                    "ObjCache - Checkout Shipping Selection Changed - Customer {0}",
                                    ((CheckoutShippingSelectionDependencyStateContext)establishedState.Context).CustomerId));
            }

            return(stateChanged);
        }