wcf-data-services

How to create a computed property in Data Services (OData)?

喜欢而已 提交于 2019-11-29 04:29:04
I am creating an OData service with WCF Data Services using an EDMX. How can I create a computed property for an entity type, so that its value gets computed in the service (C#) and does not come from the database? The value of this property is based on the value of other properties, which are mapped to fields in the database. If you are exposing your EDMX file directly, using the default Entity Framework Provider for Data Services, something like this: public class MyService: DataService<MyEntities> { Then unfortunately you can't expose any 'new' properties that aren't in the underlying

Data inserted successful but jquery still returning error

耗尽温柔 提交于 2019-11-28 21:19:31
I used following jQuery to insert data via Data Service. Event though I got status-response 201 and the data is successfully inserted into my database, the system still regard it as an error and gives me "failed" alert? What am I missing here? $.ajax({ type: "POST", url: "http://localhost:49223/Form/WebDataService.svc/XMLForm(guid'1eaef3a0-d6df-45bf-a8f6-3e7292c0d77e')/XMLRecord/", data: JSON.stringify(record), contentType: "application/json; charset=utf-8", dataType: "json", success: function() { alert("Success"); }, error: function(xhr) { alert("fail"); } }); UPDATE: Debug Message from Fire

Using enums in WCF Data Services

自闭症网瘾萝莉.ら 提交于 2019-11-28 20:37:11
I'm trying to manually build a WCF Data Service using a POCO data model and I cannot figure out how to properly expose enum values. Assuming a simple model like: public class Order { public int ID {get; set;} public string Description {get; set;} public OrderStatus Status {get; set;} } public enum OrderStatus { New, InProcess, Complete } How do you expose the valuable information in the OrderStatus property via the OData WCF Data Service? If you do nothing, the Data Service generates a runtime error (enum is invalid property). The only answer I've seen that at least resolves the error is to

is it possible to Query an Odata service and expand Child of Child entities?

て烟熏妆下的殇ゞ 提交于 2019-11-28 19:23:56
This sounds rather simple (and maybe I'm missing the obvious here) but I can't find a solution. I know I can query an entity and return one, or many direct child entities doing this: var query = from c in Service.Clients.Expand("Addresses,Comments,PhoneNumbers").. What I would like to be able to do is do the same with 3 levels (Children of child), lets say "Country->Province->City" or "Brand->Family->Model" I tried to expand all entities, but it fails var query = from c in Service.Brands.Expand("Families,Models").. //fails, //which even makes some sense, since Models is a Child of Family, not

Microsoft.Data.Services.Client.dll vs System.Data.Services.Client.dll

爱⌒轻易说出口 提交于 2019-11-28 13:23:35
I'm trying to use WCF Data Services and a little confused what library should I reference to interact with WCF Data Services: Microsoft.Data.Services.Client.dll or System.Data.Services.Client.dll . What is the difference between them? In which case should I use each of them? When trying to add references to both of them I get a compiler error: The type 'System.Data.Services.Client.DataServiceContext' exists in both 'e:\Program Files\WCF Data Services Mar 2011 CTP2\bin.NETFramework\Microsoft.Data.Services.Client.dll' and 'e:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4

Sequence contains no matching element - EntityFramework

天大地大妈咪最大 提交于 2019-11-28 10:45:06
I'm using EF 6.1.0 and was creating a WCF Service. First I created a Class Library containing my entities, Mappers and Context for initializing EF. I've also created a class containing an instantiation of the context and have this code: public IQueryable<[Entity]> GetAll() { return context.[Entity].AsQueryable(); } On the otherhand, I've created a WCF Service on the same project and Calls the function GetAll() in the.svc file like this: public List<[Entity]> GetList() { [iObject] repository = new [Object](new Context()); return repository.GetAll().ToList(); } The project is building. I even

Where to set a UTC datetime value in n-tier application: Presentation Layer, Domain, or Database?

我与影子孤独终老i 提交于 2019-11-28 05:13:37
问题 This seems like it should be an obvious question, but I have had some issues finding a good answer. I am building an n-tier application that needs to be UTC time sensitive. Values can be updated and when they are timestamps are recorded. This includes transactions in the database where updates or inserts will impact datetime columns. To give some context I am using SQL 2008 R2 + with DATETIMEOFFSET(2) for most of my datetime columns. I am considering putting the updates for timestamps into

How to accept JSON in a WCF DataService?

不想你离开。 提交于 2019-11-28 04:58:11
问题 I'm trying to understand how to use WCF Data Services (based on EF 4.1) to create a restful web service that will persist entities passed as JSON objects. I've been able to create a method that can accept a GET request with a set of primitive data types as arguments. I don't like that solution, I would prefer to send a POST request with a JSON object in the http request body. I've found that I can't get the framework to serialize the json into an object for me, but i would be fine with doing

WCF Streaming large data (500MB / 1GB) on a self hosted service

荒凉一梦 提交于 2019-11-28 04:24:23
I'm currently experiencing an issue trying to send large data using WCF self hosted service (no IIS). Transferring 500MB using streaming results with my service crashing with System.OutOfMemoryException. Is it possible at all to transfer such amount of data? Here is my WCF configuration: <system.serviceModel> <services> <service name="CIService" behaviorConfiguration="CIBehavior"> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:6547/CIService/CIService.svc" /> </baseAddresses> </host> <endpoint binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig"

Many-to-many relationship in .NET RIA services

喜欢而已 提交于 2019-11-28 00:28:12
问题 I have a many-to-many relationship in my database of objects A to B. When i create a domain service the metadata looks fine. A has a collections of Bs, B has a collection of As. So it is correct. However the *.g.cs file generated doesn't have the same relationship. Is there a way to make it work? I googled some answer to actually generate objects for the association table but i am curious if i can avoid this. Thanks 回答1: In the current release/version of RIA Services, you'll need the