예제 #1
0
        internal static object GetFromParent <T>(
            this FlatDataWrapper <T> wrapper,
            Enum settingType,
            Type type,
            FlattenDataProvider <T> provider)
            where T : class
        {
            var parentWrapper = provider != null
                ? provider.GetParentWrapper(wrapper)
                : wrapper.ParentWrapper;

            return(parentWrapper.Get(settingType, type, provider));
        }
        internal object Get(Enum valueName, Type valueType, FlattenDataProvider <TEntity> provider = null)
        {
            valueName.CheckValueType(valueType);

            var key = valueName.ToString();

            if (!string.IsNullOrEmpty(Data))
            {
                var settings = this.GetByKey(key, valueType);

                if (settings != null)
                {
                    return(settings);
                }
            }

            return(Parent != null
                ? this.GetFromParent(valueName, valueType, provider)
                : null);
        }
        public static TResult Get <TEntity, TResult>(this FlatDataWrapper <TEntity> wrapper, Enum valueName, FlattenDataProvider <TEntity> provider)
            where TEntity : class
        {
            var value = wrapper.Get(valueName, typeof(TResult), provider);

            return(value != null ? (TResult)value : default(TResult));
        }
예제 #4
0
 public static object GetValueFromType <T>(this FlatDataWrapper <T> wrapper, Enum valueName, FlattenDataProvider <T> provider) where T : class
 {
     return(wrapper.Get(valueName, valueName.GetValueType(), provider));
 }