TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ashish f
NA
51
0
Is there a deep insert support in HttpClient WebAPI in batch
Dec 20 2015 11:14 AM
I tried batch execution in WebAPI using HttpClient like following which is working fine. But is there a deep insert support for the same ?
private static async Task ExecuteBatchRequest()
{
private static readonly string serviceUrl = "http://localhost:65200/api";
HttpClient client = new HttpClient();
HttpRequestMessage request;
HttpResponseMessage response;
Customer addedCustomer = new Customer { Id = 10, Name = "Name " + 10 };
//Create a message to add a customer
HttpRequestMessage addCustomerRequest = new HttpRequestMessage(HttpMethod.Post, serviceUrl + "/Customers");
addCustomerRequest.Content = new ObjectContent<Customer>(addedCustomer, formatter);
//Create the different parts of the multipart content
HttpMessageContent addCustomerContent = new HttpMessageContent(addCustomerRequest);
//Create the multipart/mixed message content
MultipartContent content = new MultipartContent("mixed", "batch_" + Guid.NewGuid().ToString());
content.Add(addCustomerContent);
//Create the request to the batch service
HttpRequestMessage batchRequest = new HttpRequestMessage(HttpMethod.Post, serviceUrl + "/batch");
//Associate the content with the message
batchRequest.Content = content;
//Send the message
HttpResponseMessage batchResponse = await client.SendAsync(batchRequest);
}
In above code Customer is simple class no foreign key is there what if customer table has a foreign key for Product and want to insert Product Id first and then same Product Id will be inserted into customer Table? in this deep insert how batch execution works ?
Reply
Answers (
0
)
Data Export into XML Format in ASP.Net
asp.net juqery ui