odata

Any good sample for an updatable WCF Data Service implementation

时间秒杀一切 提交于 2019-12-12 04:05:43
问题 I am looking for a good sample implementing an updatable WCF Data Service. I found this article on MSDN that shows a sample implementation using IUpdatable, but not sure if I understand this post. There are methods used in this post such as GetTable() and SubmitChanges(), whose implementation is not provided. Appreciate any pointers. 回答1: Found this one most useful - http://blogs.microsoft.co.il/blogs/gilf/archive/2008/08/31/how-to-perform-crud-operations-in-ado-net-data-services-with-custom

Dynamics CRM: Odata query that checks if the file attachment file name contains the unicode '#'

吃可爱长大的小学妹 提交于 2019-12-12 03:59:37
问题 Scenario: I have a custom entity with attachments in Dynamics CRM 2011. I want to query those attachments with file name that contains a hash tag ('#'). Say I have attached a few text documents. kdk#ie.txt, Report.txt, & k!ke.txt to the custom entity. Here are my results to my Odata query. Error Code: //ORGANIATION/XRMServices/2011/OrganizationData.svc/AnnotationSet?$filter=ObjectId/Id eq guid'{GUID HERE}' and IsDocument eq true and substringof('#',FileName) Return: Bad Request Because it is

OData aggregate query with Count

独自空忆成欢 提交于 2019-12-12 03:48:49
问题 In odata 5.3.1 the aggregate query was not working so that I wrote my custom facet class to get aggregate count of items. http://localhost/odata/Document$apply=groupby((Category),%20aggregate(Document/$count%20as%20Total)) But in Odata 5.9.1 the above query is failing as because it has already aggregate function included. So for my custom method it is not working. GithHub aggregate function I want data something like this : "value": [ { "name" : "doc1", "version" 2: , "total": 5 }, { "name" :

odata v4 client code generator: how to do deep insert?

血红的双手。 提交于 2019-12-12 03:35:23
问题 What I have is something like var item1 = new Item { CODE = "ABC1", NAME = "A B C 1" }; var item2 = new Item { CODE = "ABC2", NAME = "A B C 2" }; var items = new DataServiceCollection<Item >{ item1, item2 }; var mt = new MyType { CURRDATE = DateTime.Now.toString(), ITEMS = items }; _container.AddToMyType(mt); var resp = _container.SaveChanges(); //...etc is that right? it's complaining something about "Unhandled Exception: System.InvalidOperationException: An item could not be added to the

Querying WCF Services with OData Params in POST instead of GET

假如想象 提交于 2019-12-12 03:32:06
问题 We call wcf svcs (not ours) and we're using gets for searching a product database. Example: http://foo.com/SearchProducts.svc?$skip=0$take=10$includeTotalCount=true We were passing the Odata parameters to page the results of the SearchProducts svc. The svc has been changed to a POST because one of our filters "skus" is sometimes huge (hundres of skus) which causes the GET to break because the uri is too large. The easiest solution we thought was to just change the call to a post but now the

Add filter on property for odata query

老子叫甜甜 提交于 2019-12-12 03:28:08
问题 I have an entity: ItContract and every ItContract belongs to an organisation unit. A user logs-in to an organisation unit and have read access to all data. How can I set a filter on organisationUnitId on the server for every odata query? I am using odata v4 with asp.net. 回答1: There is a way to override the queryOption you get in server side. public IHttpActionResult Get(ODataQueryOptions<People> queryOptions) { // get the original request before the alterations HttpRequestMessage

Odata Client with Cookie

青春壹個敷衍的年華 提交于 2019-12-12 03:07:38
问题 The following code has been implemented to get JsessioniD from the Cookies. The webSite uses form authentication. Here is what I have implemented. public override void ViewDidLoad () { base.ViewDidLoad (); using(var client= new CookieAwareWebClient()) { var values= new NameValueCollection { {"username","admin"}, {"password","admin"}, }; client.UploadValues("myURL/j_security_check",values); Cookie jSessionID = client.ResponseCookies["JSESSIONID"]; if (jSessionID != null) { // get the JEssionID

Using IEdmModel to resolve EntitySet name into EntityName (Products -> Product)

血红的双手。 提交于 2019-12-12 02:33:59
问题 I am using a OData Service on top of Entity Framework var uri = new Uri("http://localhost:9876/Service.svc"); var context = new DataServiceContext(uri, , DataServiceProtocolVersion.V3); var model = EdmxReader.Parse( XmlReader.Create(context.GetMetadataUri().AbsoluteUri) ); context.Format.UseJson(model); Now I need to figure out the entity name name from an EntitySet name My entities are called Product or Customer but the Name of the EntitySet can be either Products or CustomerSet or something

Implementing WebAPI with circular dependencies and loadable lists

我们两清 提交于 2019-12-12 02:20:02
问题 How it is possible to implement such "smart" GET in WebAPI? I have 2 classes that i want to get from my service. Let's say its book store which has relation to book objects. public class Book { Guid Id { get; set; } string Title { get; set; } Store Store { get; set; } } public class Store { Guid Id { get; set; } string Title { get; set; } string Owner { get; set; } IEnumerable<Book> Books { get; set; } } I have backend with SQL server and EntityFramework adapter in code. How should I make to

casting int to string in OData raises error

て烟熏妆下的殇ゞ 提交于 2019-12-12 01:59:31
问题 why the cast is not working here? http://services.odata.org/Northwind/Northwind.svc/Orders?$filter=startswith(cast(OrderID, 'Edm.String'),'1') it says: No coercion operator is defined between types 'System.Int32' and 'System.String'. 回答1: OData doesn't support conversion to and from string. It supports conversions between related entity types and between numeric primitive types only. See http://msdn.microsoft.com/en-us/library/dd541472(v=PROT.10).aspx and the castExpression paragraph. It's