예제 #1
0
        public static void RegisterValidate <T>(IValidate <T> iTargetValidate)
        {
            lock (lockObject)
            {
                Type TType    = typeof(T);
                int  TTypeKey = TType.GetHashCode();

                if (!mTValidates.ContainsKey(TTypeKey))
                {
                    Dictionary <int, object> dicValidate = new Dictionary <int, object>();
                    int keyiTargetValidate = iTargetValidate.GetHashCode();
                    dicValidate.Add(keyiTargetValidate, iTargetValidate);
                    mTValidates.Add(TTypeKey, dicValidate);
                }
                else
                {
                    int keyTargetValidate = iTargetValidate.GetHashCode();
                    if (!mTValidates[TTypeKey].ContainsKey(keyTargetValidate))
                    {
                        mTValidates[TTypeKey].Add(keyTargetValidate, iTargetValidate);
                    }
                    else
                    {
                        mTValidates[TTypeKey][keyTargetValidate] = iTargetValidate;
                    }
                }
            }
        }