This project is read-only.

URL sanitization ?


This is in the description on the main CP page.... Anyone know what it does?

I'm trying to find out if there is a way to make the URL case-insensitive...

This works: http://svc.localhost/MyService.svc/Brands

This does not work: http://svc.localhost/MyService.svc/brands

Thanks for any info.


Airslash wrote Feb 5, 2013 at 10:49 PM

The reason why the URL is not case sensitive is due convention of the OData protocol.
The protocol states that the section followed by the .svc either points to an OData Service Operation or to an entity set.

In case of an OData service operation, it maps to an actual function written in C#. C# is not case sensitive.
In case of an entity set, the protocol states that the entityset must be pluralized, being the plural of the Class of the entity. Again the class is part of C#, thus case sensitive.

The way this is enforced in the toolkit is by looking up the URL path and determine the entity set or operation. Once the string has been identified, Reflection is used to actually map and invoke this, thus you cannot be case-insensitive at this point.

When looking at the source, the following method NEEDS to be implemented:
/// <summary>
/// Obtains information about which repository will be used based on the entity full type name.
/// </summary>
/// <param name="fullTypeName">The entity full type name.</param>
/// <returns>A repository for a given entity full type name.</returns>
public abstract object RepositoryFor(string fullTypeName);
So if you overwrite this behavior to perform the look case-insensitive (if Reflector supports this) you might get away with it.