예제 #1
0
        private static Func <CT, CT, bool> GetComparerForCollections <CT>(Delegate comparer, IPropFactory propFactory, bool useRefEquality)
        {
            Func <CT, CT, bool> compr;

            if (useRefEquality || comparer == null)
            {
                return(propFactory.GetRefEqualityComparer <CT>());
            }
            else
            {
                return(compr = (Func <CT, CT, bool>)comparer);
            }
        }
예제 #2
0
        //// From String
        //private static IProp<T> CreatePropFromString<T>(IPropFactory propFactory,
        //    string value, bool useDefault,
        //    PropNameType propertyName, object extraInfo,
        //    PropStorageStrategyEnum storageStrategy, bool isTypeSolid,
        //    Delegate comparer, bool useRefEquality = false)
        //{
        //    T initialValue;
        //    if (useDefault)
        //    {
        //        initialValue = propFactory.ValueConverter.GetDefaultValue<T>(propertyName);
        //    }
        //    else
        //    {
        //        initialValue = propFactory.GetValueFromString<T>(value);
        //    }

        //    return propFactory.Create<T>(initialValue, propertyName, extraInfo, storageStrategy, isTypeSolid,
        //        GetComparerForProps<T>(comparer, propFactory, useRefEquality));
        //}

        //// With No Value
        //private static IProp<T> CreatePropWithNoValue<T>(IPropFactory propFactory,
        //    PropNameType propertyName, object extraInfo,
        //    PropStorageStrategyEnum storageStrategy, bool isTypeSolid,
        //    Delegate comparer, bool useRefEquality = false)
        //{
        //    return propFactory.CreateWithNoValue<T>(propertyName, extraInfo, storageStrategy, isTypeSolid,
        //        GetComparerForProps<T>(comparer, propFactory, useRefEquality));
        //}

        private static Func <T, T, bool> GetComparerForProps <T>(Delegate comparer, IPropFactory propFactory, bool useRefEquality)
        {
            if (useRefEquality)
            {
                return(propFactory.GetRefEqualityComparer <T>());
            }
            else if (comparer == null)
            {
                return(null);
            }
            else
            {
                return((Func <T, T, bool>)comparer);
            }
        }