' BookService.Models.Author ' contains cycles and cannot being serialized if reference tracking is Disabled.exceptionmessage> exceptiontype>System.Runtime.Serialization.SerializationExceptionexceptiontype> StackTrace>...StackTrace> innerexception>Error>One solution is to use a dto, and I'll describe it in the next section.You can configure the JSON or XML formatter to handle graph loops. For a lot of other information, see Handling Circular Object References. (Http://www.asp.net/web-
relationship mapping: Maps to a many-to-one mapping relationship in a data table, using @manytoone annotation definitions. Many-to-many relationship mappings: Maps to a many-to-many mapping relationship in a data table, using the @manytomany annotation definition. ORM Basic Correspondence Rules:1. The class corresponds with the table 2. The properties of the class correspond to the fields of the table 3. Instances of the class correspond to a specific record in the tableThe following will e
Original address: http://www.it165.net/pro/html/201210/3932.htmlRecently started to study web API, good luck the first test project encountered a problem @@-when new control is selected [API Controller woth read/write actions, using Entity Framework] Then use the Northwnd database, data table select Orders,order_details,products.The front-end JavaScript program c
Recently, it has been hard to find out whether to create restful APIs or those previously called functions. If you create a restful API, there are many design issues to be clarified. This is not a matter of time. When you use a web API to create a restful API, how can I design an API for second-level
The ASP. NET Web API displays entity Link-related aspects, apilink
Sometimes, when we request an object from the server, we want to return the following format:
Links :[Href: http: // localhost: 8901/api/user/diaries/2013-08-17,Rel: "self ",Method: "GET ",IsTemplated: false],CurrentDate: "2013-08-17"
First, a Link-related class is abstracted:
public class Lin
next to the "Persistent API (JPA) series (vii) Entity Relationship Mapping (ORM) Single-table mapping @idclass"This article describes the Federated primary key: Using @embeddedid to embed an external primary keyThe above is a reference to the external primary key via @idclass, and the Federated primary Key can also be used Embedded PRIMARY Key Alternative. 1) New external primary key class Family2.javaSet t
Fluent API in Code-first:We have seen different dataannotations attributes in the previous sections to override default Code-first conventions. Here, we'll learn about the Fluent API.Fluent API is another-configure your domain classes. Fluent API provides more functionality for configuration than dataannotations. Fluent API
Before reading this article, you can go to the Asp. Net Web API 2 series navigation to view the sample code http://pan.baidu.com/s/1o6lqXN8 Most datasets define the relationship between entities: customers have orders, books have authors, and products have suppliers. The client can use OData to operate relations between entities. Given a product, you can find its suppliers. You can also create or delete a link. For example, you can set up a supplier f
;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceef4{ Public classDbcontextclass:dbcontext { PublicDbcontextclass ():Base("ConnectionStrings") { } PublicDbsetGet;Set; } PublicDbsetGet;Set; } protected Override voidonmodelcreating (Dbmodelbuilder modelBuilder) {//schema of the Configuration data table//modelbuilder.hasdefaultschema ("Hello"); //mapping entities to tables//modelbuilder.entity//modelbuilder.entity//Map an entity
It is very simple to use DataAnnotation. However, for the features in EntityFramework, EntityFramework assembly must be introduced in the Entity class. However, it is best to keep the POCO class unrelated to the architecture to make it more universal. Therefore, it is best to use FluentAPI in the data layer to map object classes to databases. In terms of functions, Data Annotations is a subset of Fluent APIs. All functions that Data Annotations can im
Create a projectOpen Visual Studio, select ASP. NET WEB application, project name Bookservice and click OK.Select Web API TemplateIf you want to use Azure App Service, you can tick on it, in this section, not checking does not affect the final result.I showed that it was checked and clicked OK to create the project.If you did not check Azure just now, you can skip the following.To configure Azure (optional)Before you sign in to Azure,visual Studio, yo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.