Generate Mysql entities using EF Power Tool Code Frist

Source: Internet
Author: User

Original: Generate Mysql entity using EF Power Tool Code Frist

1, right-click on the project to be generated

2,

3,

4,

5, post-build effect

Known Issues:

1, in MySQL data table tinyint (1), will be mapped into C # bool, which results in some loss of data information. This problem should be a problem with the EF tool and there is no solution for the moment.

Manual to modify the generated entity is not economical, next time update, will become bool type.

So the solution is to modify the database field type, under normal circumstances, the data type to Dali is no problem.

Optional: Change to smallint (1), which will be mapped to C # short type.

Instead, tinyint (2) will be mapped to C # sbyte.

Both of these types can meet the requirements of the general situation.

Frequently modified statements (below is an example, do not copy directly):

Change to tinyint (2)

Alter Table
default ' 0 ' not Null

or change to Smallinit (1)

Alter  table ' database name '. ' Name '   
smallint (1)  default ' 0 '  not Null

Related Article

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.