예제 #1
0
        ParameterBinder GetBinderForType(Type type, IFromRouteAttribute routeAttr, out BinderSource source)
        {
            ParameterBinder paramBinder = null;

            source = BinderSource.None;

            if (routeAttr != null &&
                routeAttr.BinderType != null)
            {
                paramBinder = ParameterBinder.GetInstance(null, routeAttr.BinderType);

                if (paramBinder != null)
                {
                    source = BinderSource.Parameter;
                    return(paramBinder);
                }
            }

            type = TypeHelpers.GetNullableUnderlyingType(type);

            if (this.Register.Settings.ParameterBinders.TryGetItem(type, out paramBinder))
            {
                source = BinderSource.Settings;
                return(paramBinder);
            }

            paramBinder = ParameterBinder.GetInstance(type, null);

            if (paramBinder != null)
            {
                source = BinderSource.Type;
            }

            return(paramBinder);
        }
        ParameterBinder GetBinderForType(Type type, IFromRouteAttribute routeAttr, out BinderSource source)
        {
            ParameterBinder paramBinder = null;
             source = BinderSource.None;

             if (routeAttr != null
            && routeAttr.BinderType != null) {

            paramBinder = ParameterBinder.GetInstance(null, routeAttr.BinderType);

            if (paramBinder != null) {
               source = BinderSource.Parameter;
               return paramBinder;
            }
             }

             type = TypeHelpers.GetNullableUnderlyingType(type);

             if (this.Register.Settings.ParameterBinders.TryGetItem(type, out paramBinder)) {
            source = BinderSource.Settings;
            return paramBinder;
             }

             paramBinder = ParameterBinder.GetInstance(type, null);

             if (paramBinder != null) {
            source = BinderSource.Type;
             }

             return paramBinder;
        }