Ejemplo n.º 1
0
        protected virtual IPropTemplate <T> GetPropTemplate <T>
        (
            PropKindEnum propKindEnum,
            PropStorageStrategyEnum storageStrategy,
            Func <T, T, bool> comparer,
            bool comparerIsRefEquality,
            Func <string, T> getDefaultVal
        )
        {
            // Supply a comparer, if one was not supplied by the caller.
            bool comparerIsDefault;

            if (comparer == null)
            {
                comparer          = EqualityComparer <T> .Default.Equals;
                comparerIsDefault = true;
            }
            else
            {
                comparerIsDefault = false;
            }

            bool defaultValFuncIsDefault;

            // Use the Get Default Value function supplied or provided by this Prop Factory.
            if (getDefaultVal == null)
            {
                getDefaultVal           = ValueConverter.GetDefaultValue <T>;
                defaultValFuncIsDefault = true;
            }
            else
            {
                defaultValFuncIsDefault = false;
            }

            IPropTemplate <T> propTemplateTyped = new PropTemplateTyped <T>
                                                  (
                propKindEnum,
                storageStrategy,
                this.GetType(),
                comparerIsDefault,
                comparerIsRefEquality,
                comparer,
                getDefaultVal,
                defaultValFuncIsDefault
                                                  );

            IPropTemplate <T> existingEntry = (IPropTemplate <T>)DelegateCacheProvider.PropTemplateCache.GetOrAdd(propTemplateTyped);

            return(existingEntry);
        }
Ejemplo n.º 2
0
 public bool Equals(PropTemplateTyped <T> other)
 {
     return(Equals(other as IPropTemplate));
 }