EntityFrameWork step on, EntityFrameWork step on
1. EF does not support the use of two or more different dbcontext in the same linq. It must be disassembled before it can be used;
Ef does not support mixed use of the custom set and dbcontext attributes.
2. If you want to use a unified domain account to connect to the database, you must set this domain account in the IIS Application pool, as shown in.
3. If table B in dbcontex needs to use the ID returned after Table A is saved, it is also very simple. When dbcontex. a will automatically bring the records of successful database insertion to dbcontext after saving is executed. a above
In this way, you can obtain the new record after the database is saved, and the new value table B is used.
4. If the format of the returned results after serialization is set, the following methods can be used:
Public static HttpResponseMessage Create (object operationResult, object data = null, string message = null)
{
PageReturnResult pageResult = new PageReturnResult (operationResult, data, message );
// JsonFormatter. SerializerSettings. Re. ferenceLoopHandling = ReferenceLoopHandling. Ignore;
String returnString = JsonConvert. SerializeObject (pageResult, Formatting. Indented,
New JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling. Ignore
});
Return new HttpResponseMessage {Content = new StringContent (returnString, Encoding. GetEncoding ("UTF-8"), "application/json ")};
}