I have an Entity model that uses a string for the primary key.
```
public class Program
{
public string Id { get; set; }
public string Name { get; set; }
}
```
I build my model using convention:
```
ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
modelBuilder.EntitySet<Program>("Programs");
IEdmModel model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute("ODataRoute", "odata", model);
```
And when I visit the /odata/Programs address, this is what one of the urls that are automatically generated looks like (a picture of the "odata=verbose" response from the controller is attached). Notice the single quotes around the key:
```
http://localhost:4730/odata/Programs('6d6e6d74-2410-4463-997d-d28f03145139')
```
That worked fine when I was only using the "OData" methods on the EntitySetController, such as:
```
Program GetEntityByKey(string key)
Program UpdateEntity(string key, Program update)
```
The problem came when I started needing to return HttpStatusCodes. I saw EntitySetController had the following method I could override, just like the vanilla ApiController:
```
HttpResponseMessage Get(string key)
```
But when I overrode it, I noticed the API no longer worked like I expected. The url that's automatically generated contains single quotes in the key (Programs('6d6e6d74-2410-4463-997d-d28f03145139')), and those quotes are stripped out when calling the GetEntityByKey(string key) method. But when the "HttpResponseMessage Get(string key)" method is overridden, the controller calls that method instead (which is what I want), but it _doesn't_ strip out the single quotes. The key that gets passed into the HttpResponseMessage method looks like this:
```
'6d6e6d74-2410-4463-997d-d28f03145139'
```
So in order to un-break the API, I have to check for and remove the single quotes at the beginning of every method that returns an HttpResponseMessage:
```
public override HttpResponseMessage Get(string key)
{
if (key.StartsWith("'")) {
key key = key.Substring(1, key.Length-2);
}
... // do controllers stuff
```
Is this intentional or a bug? If this is intentional, do you have a suggestion on how I should handle this?
```
public class Program
{
public string Id { get; set; }
public string Name { get; set; }
}
```
I build my model using convention:
```
ODataModelBuilder modelBuilder = new ODataConventionModelBuilder();
modelBuilder.EntitySet<Program>("Programs");
IEdmModel model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute("ODataRoute", "odata", model);
```
And when I visit the /odata/Programs address, this is what one of the urls that are automatically generated looks like (a picture of the "odata=verbose" response from the controller is attached). Notice the single quotes around the key:
```
http://localhost:4730/odata/Programs('6d6e6d74-2410-4463-997d-d28f03145139')
```
That worked fine when I was only using the "OData" methods on the EntitySetController, such as:
```
Program GetEntityByKey(string key)
Program UpdateEntity(string key, Program update)
```
The problem came when I started needing to return HttpStatusCodes. I saw EntitySetController had the following method I could override, just like the vanilla ApiController:
```
HttpResponseMessage Get(string key)
```
But when I overrode it, I noticed the API no longer worked like I expected. The url that's automatically generated contains single quotes in the key (Programs('6d6e6d74-2410-4463-997d-d28f03145139')), and those quotes are stripped out when calling the GetEntityByKey(string key) method. But when the "HttpResponseMessage Get(string key)" method is overridden, the controller calls that method instead (which is what I want), but it _doesn't_ strip out the single quotes. The key that gets passed into the HttpResponseMessage method looks like this:
```
'6d6e6d74-2410-4463-997d-d28f03145139'
```
So in order to un-break the API, I have to check for and remove the single quotes at the beginning of every method that returns an HttpResponseMessage:
```
public override HttpResponseMessage Get(string key)
{
if (key.StartsWith("'")) {
key key = key.Substring(1, key.Length-2);
}
... // do controllers stuff
```
Is this intentional or a bug? If this is intentional, do you have a suggestion on how I should handle this?