public MXRouteDescriptionSet(IMXRouteDescriptionGenerator patternGenerator, IMXControllerConvention controllerConvention, IMXActionConvention actionConvention) { _patternGenerator = patternGenerator; _controllerConvention = controllerConvention; _actionConvention = actionConvention; }
private Dictionary <string, string> GenerateFullDefaultParameters(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable <IMXParameterConvention> defaultParametersList) { var toReturn = new Dictionary <string, string>(); if (controllerConvention != null) { toReturn[MXConventionConstants.ControllerParameterKeyName] = controllerConvention.ConventionName; } if (actionConvention != null) { toReturn[MXConventionConstants.ActionParameterKeyName] = actionConvention.ConventionName; } if (defaultParametersList != null) { foreach (var p in defaultParametersList) { toReturn[p.ConventionName] = p.DefaultValue == null ? null : p.DefaultValue.ToString(); } } return(toReturn); }
private string GeneratePattern(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable<IMXParameterConvention> activeParametersList) { var patternParts = new List<string>() {controllerConvention.ConventionName}; if (actionConvention != null) patternParts.Add(actionConvention.ConventionName); if (activeParametersList != null) patternParts.AddRange(activeParametersList.Select(x => "{" + x.ConventionName + "}")); var pattern = string.Join(MXConventionConstants.UrlPathSeparator, patternParts); return pattern; }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable <IMXParameterConvention> activeParametersList, IEnumerable <IMXParameterConvention> defaultParametersList) { return(new MXRouteDescription() { DefaultParameters = GenerateFullDefaultParameters(controllerConvention, actionConvention, defaultParametersList), Pattern = GeneratePattern(controllerConvention, actionConvention, activeParametersList) }); }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable<IMXParameterConvention> activeParametersList, IEnumerable<IMXParameterConvention> defaultParametersList) { return new MXRouteDescription() { DefaultParameters = GenerateFullDefaultParameters(controllerConvention, actionConvention, defaultParametersList), Pattern = GeneratePattern(controllerConvention, actionConvention, activeParametersList) }; }
private Dictionary<string, string> GenerateFullDefaultParameters(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable<IMXParameterConvention> defaultParametersList) { var toReturn = new Dictionary<string, string>(); if (controllerConvention != null) toReturn[MXConventionConstants.ControllerParameterKeyName] = controllerConvention.ConventionName; if (actionConvention != null) toReturn[MXConventionConstants.ActionParameterKeyName] = actionConvention.ConventionName; if (defaultParametersList != null) foreach (var p in defaultParametersList) toReturn[p.ConventionName] = p.DefaultValue == null ? null : p.DefaultValue.ToString(); return toReturn; }
private string GeneratePattern(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable <IMXParameterConvention> activeParametersList) { var patternParts = new List <string>() { controllerConvention.ConventionName }; if (actionConvention != null) { patternParts.Add(actionConvention.ConventionName); } if (activeParametersList != null) { patternParts.AddRange(activeParametersList.Select(x => "{" + x.ConventionName + "}")); } var pattern = string.Join(MXConventionConstants.UrlPathSeparator, patternParts); return(pattern); }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable <IMXParameterConvention> activeParametersList) { return(Generate(controllerConvention, actionConvention, activeParametersList, null)); }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention) { return(Generate(controllerConvention, actionConvention, null, null)); }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention, IEnumerable<IMXParameterConvention> activeParametersList) { return Generate(controllerConvention, actionConvention, activeParametersList, null); }
public MXRouteDescription Generate(IMXControllerConvention controllerConvention, IMXActionConvention actionConvention) { return Generate(controllerConvention, actionConvention, null, null); }