Entity Framewor Learning Notes (Enum)

Source: Internet
Author: User

EF 6 supports processing of enum

Here's just a concept, because I'm not using this approach.

First, the difference between MySQL and SQL Server

MySQL has an Enum of this type, insert is put in int, when it comes out it will be a string (int to STR is set in MySQL)

MSSQL does not support Enum type, nor is it a good simulation. (Some people use check constraint to simulate, I think not very ideal)

into question,

SQL should use Int.

EF will replace the enum with an int, and we'll just have to enum.

The json.net will process the enum when deserializing,

Not at the time of serialization, but we can tune it ourselves.

Http://stackoverflow.com/questions/2441290/json-serialization-of-enum-as-string

The reason I'm not using it now is that I don't think I can directly see the string value in SQL, unless I open it in C #, which is a bit too dependent.

If you have good practice, you can reply to me. Thank you for this!

Entity Framewor Learning Notes (Enum)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.