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