Apologies if these are rookie questions
I have read the documentation and examples from the codeplex site.
I am playing around with smartstore and have created a simple console app that I intend to use to import Categories and Sub Categories into the SmartStore website.
I have had a look at the web client tools. I have 2 questions...
1.) Visual Studio - Service reference
I initially added a service reference to my project e.g. http://server/odata/v1/$metadata
I could generate the context and the query by doing this:
var context = new SmartStore.Container(new Uri("http://server/odata/v1/")); var categories = from cats in context.Categories select cats; foreach (var category in categories) { var name = category.Name; }
When i run this though,I get this error....
<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n <m:code />\r\n <m:message xml:lang=\"en-US\">An error has occurred.</m:message>\r\n <m:innererror>\r\n <m:message>Object reference not set to an instance of an object.</m:message>\r\n <m:type>System.NullReferenceException</m:type>\r\n <m:stacktrace> at SmartStore.Web.Framework.WebApi.Security.WebApiAuthenticateAttribute.OnAuthorization(HttpActionContext actionContext)
\n at System.Web.Http.Filters.AuthorizationFilterAttribute.OnAuthorizationAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
\n--- End of stack trace from previous location where exception was thrown ---
\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
\n--- End of stack trace from previous location where exception was thrown ---
\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()</m:stacktrace>\r\n </m:innererror>\r\n</m:error>
From which Im understanding it to be a security issue...and my question is, how can I pass the security/authentication details into the request?? Using this method would be my preference due to the early bound generated stuff as well as the other methods on hand?
I thought that maybe i could add the authentication stuff when the request is built?
context.BuildingRequest +=context_BuildingRequest;
2.) OData batch processing
Having abandoned the above, I implemented the example from the codeplex,using the HttpWebRequest methods etc.
Now I wanted to know how to implement batch processing?I.e. submitt a request with for example '5 create request' in the single request instead of hitting the server 5times? I know odata supports batch processing but I couldnt see how to make it work with the SmartStore examples
Thanks!!