private static void populateRoute(string pattern, Type inputType, IRouteInput input) { parse(pattern, (propName, defaultValue) => { PropertyInfo property = inputType.GetProperty(propName); if (property == null) { throw new FubuException(1002, "Url pattern \"{0}\" refers to non-existent property {1} on {2}.", pattern, propName, inputType.FullName); } var parameter = new RouteParameter(new SingleProperty(property)) { DefaultValue = defaultValue }; input.AddRouteInput(parameter, false); }); // Populate the remaining QueryString parameters var props = inputType.GetProperties(); foreach (var propertyInfo in props) { PropertyInfo info = propertyInfo; if (propertyInfo.HasAttribute <QueryStringAttribute>() && !input.RouteParameters.Any(p => p.Name == info.Name)) { input.AddQueryInput(propertyInfo); } } }
public void ApplyInputType(Type inputType) { if (inputType.CanBeCastTo <ResourcePath>()) { return; } Input = RouteBuilder.Build(inputType, Pattern).Input; }
public static void PopulateQuerystringParameters(Type inputType, IRouteInput input) { var props = inputType.GetProperties(); foreach (var propertyInfo in props) { PropertyInfo info = propertyInfo; if (propertyInfo.HasAttribute <QueryStringAttribute>() && !input.RouteParameters.Any(p => p.Name == info.Name)) { input.AddQueryInput(propertyInfo); } } }
private static void populateRoute(string pattern, Type inputType, IRouteInput input) { parse(pattern, (propName, defaultValue) => { PropertyInfo property = inputType.GetProperty(propName); if (property == null) { throw new FubuException(1002, "Url pattern \"{0}\" refers to non-existent property {1} on {2}.", pattern, propName, inputType.FullName); } var parameter = new RouteParameter(new SingleProperty(property)) { DefaultValue = defaultValue }; input.AddRouteInput(parameter, false); }); }
public void ApplyInputType(Type inputType) { if (inputType.CanBeCastTo<ResourcePath>()) return; Input = RouteBuilder.Build(inputType, Pattern).Input; }
public void ApplyInputType(Type inputType) { Input = RouteBuilder.Build(inputType, Pattern).Input; }