Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all 7215 articles
Browse latest View live

Closed Issue: NullRef with RouteDataValueProvider if route template has catch all parameter [581]

$
0
0
class Program
{
static void Main(string[] args)
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute("default", "{controller}({id})/{*pathinfo}");
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

HttpServer server = new HttpServer(config);
HttpClient client = new HttpClient(server);

HttpResponseMessage response = client.GetAsync("http://localhost/Test(42)").Result;
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
}

public class TestController : ApiController
{
public int Get(int id)
{
return id;
}
}

System.NullReferenceException occurred
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=System.Web.Http
StackTrace:
at System.Web.Http.ValueProviders.Providers.RouteDataValueProvider.<GetRoutes>d__4.MoveNext()
InnerException:

System.Web.Http.dll!System.Web.Http.ValueProviders.Providers.RouteDataValueProvider.GetRoutes(System.Web.Http.Routing.IHttpRouteData routeData) Line 21 + 0x3f bytes C#
System.Web.Http.dll!System.Web.Http.ValueProviders.Providers.NameValuePairsValueProvider.InitializeValues(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,string>> nameValuePairs) Line 54 + 0x165 bytes C#
System.Web.Http.dll!System.Web.Http.ValueProviders.Providers.NameValuePairsValueProvider..ctor.AnonymousMethod__4() Line 34 + 0x1a bytes C#
mscorlib.dll!System.Lazy<System.Collections.Generic.Dictionary<string,object>>.CreateValue() + 0xb5 bytes
mscorlib.dll!System.Lazy<System.Collections.Generic.Dictionary<string,object>>.LazyInitValue() + 0x99 bytes
mscorlib.dll!System.Lazy<System.Collections.Generic.Dictionary<string,object>>.Value.get() + 0x4c bytes
System.Web.Http.dll!System.Web.Http.ValueProviders.Providers.NameValuePairsValueProvider.GetValue(string key) Line 104 + 0xd bytes C#
System.Web.Http.dll!System.Web.Http.ValueProviders.Providers.CompositeValueProvider.GetValue(string key) Line 38 + 0xc bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.Binders.TypeConverterModelBinder.BindModel(System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.ModelBinding.ModelBindingContext bindingContext) Line 19 + 0x26 bytes C#
System.Web.Http.dll!System.Web.Http.Controllers.HttpActionContextExtensions.Bind(System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.ModelBinding.ModelBindingContext bindingContext, System.Collections.Generic.IEnumerable<System.Web.Http.ModelBinding.IModelBinder> binders) Line 163 + 0xf bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.Binders.CompositeModelBinder.TryBind(System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.ModelBinding.ModelBindingContext bindingContext) Line 68 + 0x27 bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.Binders.CompositeModelBinder.BindModel(System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.ModelBinding.ModelBindingContext bindingContext) Line 38 + 0xf bytes C#
System.Web.Http.dll!System.Web.Http.ModelBinding.ModelBinderParameterBinding.ExecuteBindingAsync(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken) Line 57 + 0x18 bytes C#


Comments: Verified.

Closed Issue: HttpRouteConstraint is called multiple times if the Match method returns false [403]

$
0
0
If the Match method of an IHttpRouteConstraint implementation returns false, the route constraint is called twice.

Repro can be found on http://aspnetwebstack.codeplex.com/discussions/394164

Is this a bug or an expected behavior?
Comments: I too was unable to reproduce this issue.

Closed Issue: Return 415 if there is a body parameter and no formatter can read the body [843]

$
0
0
This could happen if the content type is not specified in the request or if there is no formatter that can handle the specified content-type.

we should return a 415 in these cases.


Comments: Verified.

Closed Issue: HttpRoute changes whitespace route templates to the empty string [955]

$
0
0
We should keep whitespace as whitespace.
Comments: Verified.

Closed Issue: Custom attributes - underscores in name should be replaced [610]

$
0
0
When passing custom attributes to helpers via anonymous object, the "_" should be replaced with "-" just like in MVC helpers

example:

[Fact]
public void WebGridCustomHtmlAttributeIsSpecified()
{
var grid = new WebGrid(GetContext(), ajaxUpdateContainerId: "grid")
.Bind(new[]
{
new { P1 = 1, P2 = '2', P3 = "3" },
new { P1 = 4, P2 = '5', P3 = "6" }
});
var html = grid.GetHtml(htmlAttributes: new {data_attribute = "value"});
string _html = html.ToHtmlString();
Assert.Contains("data-attribute", _html);
}
Comments: Verified 0524 of Web Helper

Closed Issue: Custom htmlAttributes rendered incorrectly by WebGrid [575]

$
0
0
data_xxx attributes should be rendered as data-xxx, like other MVC Html helpers. See this StackOverflow question - http://stackoverflow.com/questions/12900138/add-custom-attributes-to-table-rendered-by-webgrid
I also raised this on Connect before realizing MVC is on CodePlex

Closed Issue: Owin Adapter should allow responses to be sent chunked [1007]

$
0
0
If a user tries to host a message handler like this with OWIN:

public class MyHandler : HttpMessageHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes("foo bar")));
response.Headers.TransferEncodingChunked = true;
return Task.FromResult<HttpResponseMessage>(response);
}
}

The response gets sent with a content-length instead of being sent chunked. We should respect the intent.
Comments: Verified.

Closed Feature: Validate the Action for correct bindability and return type [487]

$
0
0
If I am creating a bindable action for a particular entity, we need to validate the incoming request to see if the action is being applied to the correct entity type.

Example:
ExtendSupportDate is a bindable action on Product.

Following urls should work:
/.../.../Products(6)/ExtendSupportDate
/Products(6)/ExtendSupportDate

This should NOT work:
/.../.../ProductFamilies(6)/ExtendSupportDate
/.../.../Suppliers(6)/ExtendSupportDate

Also we need to validate the return type of the controller's method to the Action configuration's return type. Currently there is no validation.
Comments: Verified.

Created Unassigned: [Regression]XmlMediaTypeFormatter does not serialize Uri input correctly [1070]

$
0
0
Uri -//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM is serialized as file://[7f:d:ee9e::7a:828e:c]/-861__%25__A3+/F3&m/@pM on server by XmlMediaTypeFormatter. This works fine when using Json formatter.

Here is my client code
HttpClient client = new HttpClient();
Uri myUri = new Uri("//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM", UriKind.Absolute);

HttpRequestMessage request = new HttpRequestMessage()
{
Content = new ObjectContent<Uri>(myUri, new XmlMediaTypeFormatter()),
RequestUri = new Uri(baseAddress + "/My/EchoUriFromBody"),
Method = new HttpMethod("Post"),
};
var response = client.SendAsync(request).Result;
var myResult = response.Content.ReadAsAsync<Uri>(new List<MediaTypeFormatter>(){new XmlMediaTypeFormatter()}).Result;

Controller code
public class MyController : ApiController
{
[AcceptVerbs("PUT", "POST", "DELETE")]
public Task<Uri> EchoUriFromBody([FromBody]Uri input)
{
var task = Task.Factory.StartNew(() => input);
return task;
}
}

Edited Unassigned: [Regression]XmlMediaTypeFormatter does not serialize Uri input correctly [1070]

$
0
0
Uri- file://[7f:d:ee9e::7a:828e:c]/-861%A3+/F3&m/@pM is serialized as file://[7f:d:ee9e::7a:828e:c]/-861%**25**A3+/F3&m/@pM on server by XmlMediaTypeFormatter(Notice 25(bolded) added to the url). This works fine when using Json formatter.

Here is my client code
HttpClient client = new HttpClient();
Uri myUri = new Uri("//[07f:d:EE9e::7a:828E:C]/-861%A3+/F3&m/@pM", UriKind.Absolute);

HttpRequestMessage request = new HttpRequestMessage()
{
Content = new ObjectContent<Uri>(myUri, new XmlMediaTypeFormatter()),
RequestUri = new Uri(baseAddress + "/My/EchoUriFromBody"),
Method = new HttpMethod("Post"),
};
var response = client.SendAsync(request).Result;
var myResult = response.Content.ReadAsAsync<Uri>(new List<MediaTypeFormatter>(){new XmlMediaTypeFormatter()}).Result;

Controller code
public class MyController : ApiController
{
[AcceptVerbs("PUT", "POST", "DELETE")]
public Task<Uri> EchoUriFromBody([FromBody]Uri input)
{
var task = Task.Factory.StartNew(() => input);
return task;
}
}

Closed Issue: [Required] should not present users with duplicate errors [590]

$
0
0
See: http://aspnetwebstack.codeplex.com/discussions/396199

The implementation change here is to not recognize the [Required] model validator for reference types when doing the value validation.
Comments: Verified.

Closed Issue: Overly aggressive validation for applying [DataMember(IsRequired=true)] to required properties with value types [270]

$
0
0
With the default route and this controller:
using System.ComponentModel.DataAnnotations;
using System.Web.Http;

namespace ActionSelectionTest.Controllers
{
[FromUri]
public class Test
{
[Required]
public int ID { get; set; }
}

public class ValuesController : ApiController
{
public string Get(Test test)
{
return test.ID.ToString();
}
}
}

And a GET request to api/values/1 you get this error:

{"Message":"An error has occurred.","ExceptionMessage":"Property 'ID' on type 'ActionSelectionTest.Controllers.Test' is invalid. Value-typed properties marked as [Required] must also be marked with [DataMember(IsRequired=true)] to be recognized as required. Consider attributing the declaring type with [DataContract] and the property with [DataMember(IsRequired=true)].","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Web.Http.Validation.Validators.ErrorModelValidator.Validate(ModelMetadata metadata, Object container)\r\n at System.Web.Http.Validation.ModelValidationNode.ValidateThis(HttpActionContext actionContext, ModelValidationNode parentNode)\r\n at System.Web.Http.Validation.ModelValidationNode.Validate(HttpActionContext actionContext, ModelValidationNode parentNode)\r\n at System.Web.Http.Validation.ModelValidationNode.ValidateChildren(HttpActionContext actionContext)\r\n at System.Web.Http.Validation.ModelValidationNode.Validate(HttpActionContext actionContext, ModelValidationNode parentNode)\r\n at System.Web.Http.ModelBinding.Binders.CompositeModelBinder.BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)\r\n at System.Web.Http.ModelBinding.ModelBinderParameterBinding.ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Controllers.HttpActionBinding.<>c__DisplayClass1.<ExecuteBindingAsync>b__0(HttpParameterBinding parameterBinder)\r\n at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n at System.Threading.Tasks.TaskHelpers.IterateImpl(IEnumerator`1 enumerator, CancellationToken cancellationToken)"}

Expected result:

We shouldn’t need to require data contract attributes for FromUri types. We should only require the data contract attributes when our formatters that require them are in use.

Workaround:

Remove the validation logic in your config:

config.Services.RemoveAll(
typeof(System.Web.Http.Validation.ModelValidatorProvider),
v => v is InvalidModelValidatorProvider);

Comments: Verified.

Edited Issue: PushstreamContent in Win8 App is not working [324]

$
0
0
I am hitting an issue with using PushStreamContent in the Windows store app. I don’t see the same issue in the traditional console app though.

It’s a simple scenario where I am ‘POST’ing some small data to a service using PushStreamContent as below.

HttpClient client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://.../SimpleMvcWebAPIApplication/api/values");
request.Content = new PushStreamContent((stream, httpContent, transportContext) =>
{
using (var streamWriter = new StreamWriter(stream))
{
string data = "\"hello world\"";
streamWriter.Write(data);
streamWriter.Flush();
}
}, "application/json");

var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();

It fails as below.

System.ObjectDisposedException was unhandled by user code
HResult=-2146232798
Message=Cannot access a closed Stream.
Source=mscorlib
ObjectName=""
StackTrace:
at System.IO.__Error.StreamIsClosed()
at System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)
at System.Net.Http.HttpContent.<>c__DisplayClassf.<LoadIntoBufferAsync>b__d(Task copyTask)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at App5.App.<SimpleWebAPIService_Write_Temp1>d__f.MoveNext() in c:\personal\maying\WinRT\client\WinRTClient\App.xaml.cs:line 368
InnerException:

Commented Issue: PushstreamContent in Win8 App is not working [324]

$
0
0
I am hitting an issue with using PushStreamContent in the Windows store app. I don’t see the same issue in the traditional console app though.

It’s a simple scenario where I am ‘POST’ing some small data to a service using PushStreamContent as below.

HttpClient client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://.../SimpleMvcWebAPIApplication/api/values");
request.Content = new PushStreamContent((stream, httpContent, transportContext) =>
{
using (var streamWriter = new StreamWriter(stream))
{
string data = "\"hello world\"";
streamWriter.Write(data);
streamWriter.Flush();
}
}, "application/json");

var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();

It fails as below.

System.ObjectDisposedException was unhandled by user code
HResult=-2146232798
Message=Cannot access a closed Stream.
Source=mscorlib
ObjectName=""
StackTrace:
at System.IO.__Error.StreamIsClosed()
at System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)
at System.Net.Http.HttpContent.<>c__DisplayClassf.<LoadIntoBufferAsync>b__d(Task copyTask)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at App5.App.<SimpleWebAPIService_Write_Temp1>d__f.MoveNext() in c:\personal\maying\WinRT\client\WinRTClient\App.xaml.cs:line 368
InnerException:

Comments: I do not agree with the resolution. We need to indeed close the stream to signal pushstreamcontent that we are done writing to the stream. Also, this same piece of code works in a regular console application which indicates that the code is fine. I was able to repro this issue in a windows store app.

Closed Issue: DefaultODataActionProvider error messages [466]

$
0
0
Need to add code to insure ActionName == "" produces meaningful error messages.
One option is to move from using ActionName to full request URL in the error.

Comments: Verified.

Edited Issue: Expose the default logic of link generation to enable re-using logic. [536]

$
0
0
I agree that its easy to create links ourselves, but its natural and easier to just fallback to the default logic too.

Scenarios:
a. I would like to build a 'Transient' action on Product called "ExtendSupportDate". In my HasActionLink logic, I check to see if the given entity instance context(Product) is discontinued or not. if discontinued, i do not want to 'advertise' the action "ExtendSupportDate" otherwise I would like to re-use whatever logic the default Action link convention generates.
b. Similar as above, a scenario where you don't want to show Edit link for some entity instances and for the rest of them would want to use the default Edit link convention that we have.

Currently for scenario 'a', i am doing the following:
----------------------------------------------------------
static IEdmModel GetImplicitEdmModel()
{
ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();
var products = modelBuilder.EntitySet<Product>("Products");
var productFamilies = modelBuilder.EntitySet<ProductFamily>("ProductFamilies");
var suppliers = modelBuilder.EntitySet<Supplier>("Suppliers");

var config = products.EntityType.TransientAction("ExtendSupportDate");
config.Parameter<DateTime>("newDate");
config.ReturnsFromEntitySet<Product>("Products");
config.HasActionLink(eic =>
{
//Do not advertise 'ExtendSupportDate' for discontinued products
if(eic.EntityType.Name == "DiscontinuedProduct")
return null;

//Advertise for the rest of them
Product pd = (Product)eic.EntityInstance;

return new Uri(eic.UrlHelper.Link(ODataRouteNames.InvokeBoundAction, new {
controller = eic.EntitySet.Name,
boundId = pd.ID,
odataAction = "ExtendSupportDate" }));
});

return modelBuilder.GetEdmModel();
}

Commented Issue: Expose the default logic of link generation to enable re-using logic. [536]

$
0
0
I agree that its easy to create links ourselves, but its natural and easier to just fallback to the default logic too.

Scenarios:
a. I would like to build a 'Transient' action on Product called "ExtendSupportDate". In my HasActionLink logic, I check to see if the given entity instance context(Product) is discontinued or not. if discontinued, i do not want to 'advertise' the action "ExtendSupportDate" otherwise I would like to re-use whatever logic the default Action link convention generates.
b. Similar as above, a scenario where you don't want to show Edit link for some entity instances and for the rest of them would want to use the default Edit link convention that we have.

Currently for scenario 'a', i am doing the following:
----------------------------------------------------------
static IEdmModel GetImplicitEdmModel()
{
ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();
var products = modelBuilder.EntitySet<Product>("Products");
var productFamilies = modelBuilder.EntitySet<ProductFamily>("ProductFamilies");
var suppliers = modelBuilder.EntitySet<Supplier>("Suppliers");

var config = products.EntityType.TransientAction("ExtendSupportDate");
config.Parameter<DateTime>("newDate");
config.ReturnsFromEntitySet<Product>("Products");
config.HasActionLink(eic =>
{
//Do not advertise 'ExtendSupportDate' for discontinued products
if(eic.EntityType.Name == "DiscontinuedProduct")
return null;

//Advertise for the rest of them
Product pd = (Product)eic.EntityInstance;

return new Uri(eic.UrlHelper.Link(ODataRouteNames.InvokeBoundAction, new {
controller = eic.EntitySet.Name,
boundId = pd.ID,
odataAction = "ExtendSupportDate" }));
});

return modelBuilder.GetEdmModel();
}
Comments: I see that we have helpers for GenerateSelfLink and GenerateNavigationLink, but not for generating action links...was this on purpose...did you mean to one could first call GenerateSelfLink and then just append the action name in the end?

Closed Issue: Implement IODataUrlResolver so that ODataLib can resolve Url references that are part of a batch request [1032]

$
0
0
When doing the following batch request with DataServicesClient:

```
GeneratedDataServicesClient client = new GeneratedDataServicesClient(serviceUrl);
client.Format.UseJson();
BatchCustomer customer = client.BatchCustomer.ToList().First();
Order order = new Order() { Id = 0, PurchaseDate = DateTime.Now };
client.AddToOrder(order);
client.AddLink(customer, "Orders", order);
client.SaveChanges(SaveChangesOptions.Batch);
```

that translates into the following HTTP request:

```
POST BaseUrl/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_77c46244-d02f-4714-9e8d-28dd0910189c
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: host
Content-Length: 1099
Expect: 100-continue

--batch_77c46244-d02f-4714-9e8d-28dd0910189c
Content-Type: multipart/mixed; boundary=changeset_d758f8a5-20a0-4d01-8c33-0884b8202729

--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary

POST BaseUrl/Order HTTP/1.1
Content-ID: 11
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":0,"PurchaseDate":"2013-05-06T09:05:44.6392992-07:00"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary

POST BaseUrl/BatchCustomer(0)/$links/Orders HTTP/1.1
Content-ID: 12
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
Content-Type: application/json;odata=minimalmetadata

{"url":"$11"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729--
--batch_77c46244-d02f-4714-9e8d-28dd0910189c--
```

The request fails because the $11 reference in the second request of the batch doesn't get resolved properly. The root of the problem is that ODataLib is not able to resolve the Url. In order for ODataLib to be able to properly resolve the Url we need to implement IODataUrlResolver in the ODataMessageWrapper class.

Closed Issue: OData $batch sends the wrong response when a request within a changeset fails [1033]

$
0
0
Given a $batch request like the following, where the second operation in the changeset fails as this one

```
POST http://jcalvarro-wsr3:9001/batch/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: jcalvarro-wsr3:9001
Content-Length: 1076
Expect: 100-continue
Connection: Keep-Alive

--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Content-Type: multipart/mixed; boundary=changeset_6bb58eec-2717-4673-b074-919584c38eea

--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":10,"Name":"Customer 10"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 2
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":-1,"Name":"Customer -1"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea--
--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2--
```

the current response is the following

```

HTTP/1.1 202 Accepted
Content-Length: 886
Content-Type: multipart/mixed; boundary=batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Mon, 06 May 2013 20:52:22 GMT

--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Content-Type: multipart/mixed; boundary=changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f

--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 201 Created
Location: http://jcalvarro-wsr3:9001/batch/BatchCustomer(10)
Content-ID: 1
Content-Type: application/json; odata=minimalmetadata; charset=utf-8
DataServiceVersion: 3.0

{
"odata.metadata":"http://jcalvarro-wsr3:9001/batch/$metadata#BatchCustomer/@Element","Id":10,"Name":"Customer 10"
}
--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 400 Bad Request
Content-ID: 2


--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f--
--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f--
```

and according to the OData spec, it should be as follows:

Structurally, a batch response body MUST match one-to-one with the corresponding batch request body, such that the same multipart MIME message structure defined for requests is used for responses.
The exception to this rule is that when a request within a Change Set fails, the Change Set response is not represented using the multipart/mixed media type.
Instead, a single response, using the “application/http” media type and a Content-Transfer-Encoding header with a value of “binary”,
is returned that applies to all requests in the Change Set and MUST be formatted according to the Error Handling section of [OData:Core].

Created Unassigned: Make non-generic TryUpdateModel methods [1071]

$
0
0
Sometimes it is necessary to make a polymorphic binding of model on the basis of the interface. But if one pass the model of a particular type, wich implements the necessary interface, the binding doesn't occur because the TryUpdateMethod method is generic. Make overloads, where only the object model would be transfered to the entrance of the method:

bool TryUpdateModel(object model)
bool TryUpdateModel(object model, string prefix)

etc.

Example of usage:

```
public ActionResult Process(SomeDescriminatorEnum someDescriminator)
{
IMyModel model = GetConcreteForm(someDescriminator);
if (TryUpdateModel(model))
{
// ...
}
// ...
}
```
Viewing all 7215 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>