odata

How to set the return value of MS Fakes object?

烂漫一生 提交于 2019-12-13 02:25:51
问题 I have generated an OData Client code with the OData V4 Client Code Generator . The generated code cannot be unit tested without MS Fakes so I generated a fake assembly from it. Now I have a problem of how to actually set the return value of the methods. The "core" class in the generated code is called System : [global::Microsoft.OData.Client.OriginalNameAttribute("System")] public partial class System : global::Microsoft.OData.Client.DataServiceContext { /// <summary> /// Initialize a new

OData in .Net Core 2.2 : how to get total number of items?

萝らか妹 提交于 2019-12-13 02:14:47
问题 I've created a new .NET Core 2.2 web app, using OData v7.1. I've got it up and running and can already use $top, $skip, ... I'm trying to get $count to work properly now, but I'm completely lost at how to do it. I've already tried following several links, all of them either no longer compile, or do not produce the result I want. What I have : in StartUp.cs app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); routes.EnableDependencyInjection(

Dynamically adding WCF Data Services Endpoints

谁都会走 提交于 2019-12-13 00:25:34
问题 I've been researching oData and WCF DataServices and I think it would work great for my project. However, each of our clients have their own database. So, is there a way to dynamically create a WCF endpoint that I could point to a database. The schema for all the databases are identical. For Example: Client1 needs DB1, they would use the URL: https://webservice.com/wcf/Client1 which would use DB1 Client2 needs DB2, they would use the URL: https://webservice.com/wcf/Client2 which would use DB2

AutoMapper don't work with entity EF Core

落爺英雄遲暮 提交于 2019-12-12 23:38:50
问题 I'm trying to get view from entity with fields that I specify at expandProperties with .ProjectTo(). Using .Net Core 2 + Ef Core + AutoMapper There is entities: public class LessonCatalog { public string Name { get; set; } public int? ImageId { get; set; } public virtual Image Image { get; set; } public virtual ICollection<Lesson> Lessons { get; set; } } public class Lesson { public string Name { get; set; } public string Description { get; set; } public int? ImageId { get; set; } public

WCF Data Service - How to set Page Size programmatically?

戏子无情 提交于 2019-12-12 23:06:39
问题 I have an OData Service setup using WCF Data Services (v2) that is hosted on the server. In the client applications we are creating, we are wondering if there is any way we can programmatically set the paging size? For example, this works if I set it in the .svc: public static void InitializeService(ODataServiceConfiguration serviceConfig) { serviceConfig.SetServiceOperationAccessRule("*", ServiceOperationRights.All); serviceConfig.SetEntitySetAccessRule("*", EntitySetRights.All); // *** I

What strategies exist to accomplish transactions over an OData service layer?

元气小坏坏 提交于 2019-12-12 20:19:05
问题 Consider the following example: An OData service layer exposes Order and OrderLine resources. A consumer retrieves an Order and its related OrderLines. The consumer edits the Order, edits 1 OrderLine, deletes 1 OrderLine and creates 1 OrderLine. How can the consumer save all of these changes ensuring that the changes are all or nothing? From what I understand of OData, this will be sent as several service calls: PUT /api/Order/9999 PUT /api/OrderLine/1001 DELETE /api/OrderLine/1002 POST /api

PowerPivot not sending Authorization header in Basic Authentication to OData Svc

大城市里の小女人 提交于 2019-12-12 20:08:54
问题 QA - I know the answer. I have created a WCF Data Services OData endpoint and its all works, PowerPivot connects and I built some pivot tables. Then I implemented a Basic Authentication HTTP handler which challenges requests not presented an Authorization header with a 401 WWW-Authenticate see link: http://www.asp.net/web-api/overview/security/basic-authentication This works for IE; the browser pops a credentials input dialogue and IE continues to attach the header with subsequent requests,

Manually Creating an OData feed in Asp.Net Core, Using feed in Power BI

ⅰ亾dé卋堺 提交于 2019-12-12 18:23:28
问题 I am trying to manually write a Web Api that will serve as an OData feed. I don't need much functionality, just the ability to export data stored within Entity framework to an application such as Power BI. I only need to be able to view, so I was planning on just implementing GET requests. I currently have a standard web api that returns back properly formatted JSON, but I am having trouble formatting this into something that I can import into Power BI as an OData Feed. Here's a gist of what

Why this Linq doesn't work (Error translating Linq expression to URI: Can only specify query options (orderby, where, take, skip)

随声附和 提交于 2019-12-12 18:23:03
问题 var query = from ch in Client.wcf.context.CashHeading where ch.Id_customer == customern//cc.Id from cs in Client.wcf.context.Cash where cs.Id_cashheading == ch.Id from gg in Client.wcf.context.Good where gg.Id == cs.Id_good select gg.Price.Value; I'm getting inner error processing it: Error translating Linq expression to URI: Can only specify query options (orderby, where, take, skip) after last navigation. I can't understand why, full sources Here, on GitHub 回答1: Basically, you have to

Filter Child Property OData and ASPNET WebApi

孤者浪人 提交于 2019-12-12 16:58:39
问题 I'm facing a problem. I've googled a lot and searched in here too, but I couldn't find a answer to this problem. I have a ASPNET Web Api that returns JSON . I also, add Microsoft.Data.OData nuget to allow odata queries. It's working fine for simple cases, but now, I need to apply a filter in a child collection. Sample: {"total":1,"products":[{"id":20289,"brandId":5,"categoryId":1,"price":12.0,"name":"Carolina Herrera","description":"CH","productCode":"asd2334","picture":null,"contentPackaging