Update MySql

This commit is contained in:
sunkaixuan 2017-06-25 03:31:00 +08:00
parent 601adfdef4
commit 1b5d393f88
4 changed files with 10 additions and 10 deletions

View File

@ -12,28 +12,28 @@ namespace OrmTest.Demo
{ {
var db = GetInstance(); var db = GetInstance();
//Create all class //Create all class
db.DbFirst.CreateClassFile("c:\\Demo\\1"); db.DbFirst.CreateClassFile("c:\\DemoMySql\\1");
//Create student calsss //Create student calsss
db.DbFirst.Where("Student").CreateClassFile("c:\\Demo\\2"); db.DbFirst.Where("Student").CreateClassFile("c:\\DemoMySql\\2");
//Where(array) //Where(array)
//Mapping name //Mapping name
db.MappingTables.Add("ClassStudent", "Student"); db.MappingTables.Add("ClassStudent", "Student");
db.MappingColumns.Add("NewId", "Id", "ClassStudent"); db.MappingColumns.Add("NewId", "Id", "ClassStudent");
db.DbFirst.Where("Student").CreateClassFile("c:\\Demo\\3"); db.DbFirst.Where("Student").CreateClassFile("c:\\DemoMySql\\3");
//Remove mapping //Remove mapping
db.MappingTables.Clear(); db.MappingTables.Clear();
//Create class with default value //Create class with default value
db.DbFirst.IsCreateDefaultValue().CreateClassFile("c:\\Demo\\4", "Demo.Models"); db.DbFirst.IsCreateDefaultValue().CreateClassFile("c:\\DemoMySql\\4", "Demo.Models");
//Mapping and Attribute //Mapping and Attribute
db.MappingTables.Add("ClassStudent", "Student"); db.MappingTables.Add("ClassStudent", "Student");
db.MappingColumns.Add("NewId", "Id", "ClassStudent"); db.MappingColumns.Add("NewId", "Id", "ClassStudent");
db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\Demo\\5"); db.DbFirst.IsCreateAttribute().Where("Student").CreateClassFile("c:\\DemoMySql\\5");
//Remove mapping //Remove mapping
@ -66,7 +66,7 @@ namespace OrmTest.Demo
{ {
return old; return old;
}) })
.CreateClassFile("c:\\Demo\\6"); .CreateClassFile("c:\\DemoMySql\\6");
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace OrmTest
//OrmTest.Demo.Insert.Init(); //OrmTest.Demo.Insert.Init();
//OrmTest.Demo.Delete.Init(); //OrmTest.Demo.Delete.Init();
//OrmTest.Demo.Update.Init(); //OrmTest.Demo.Update.Init();
//OrmTest.Demo.DbFirst.Init(); OrmTest.Demo.DbFirst.Init();
//OrmTest.Demo.JoinSql.Init(); //OrmTest.Demo.JoinSql.Init();
//OrmTest.Demo.Filter.Init(); //OrmTest.Demo.Filter.Init();
//OrmTest.Demo.ComplexModel.Init(); //OrmTest.Demo.ComplexModel.Init();

View File

@ -5,7 +5,7 @@ using System.Text;
namespace SqlSugar namespace SqlSugar
{ {
public class mySqlDbFirst : DbFirstProvider public class MySqlDbFirst : DbFirstProvider
{ {
} }
} }

View File

@ -16,8 +16,8 @@ namespace SqlSugar
0 as TableId, 0 as TableId,
TABLE_NAME as TableName, TABLE_NAME as TableName,
column_name AS DbColumnName, column_name AS DbColumnName,
left(COLUMN_TYPE,LOCATE('(',COLUMN_TYPE)-1) AS DataType, CASE WHEN left(COLUMN_TYPE,LOCATE('(',COLUMN_TYPE)-1)='' THEN COLUMN_TYPE ELSE left(COLUMN_TYPE,LOCATE('(',COLUMN_TYPE)-1) END AS DataType,
SUBSTRING(COLUMN_TYPE,LOCATE('(',COLUMN_TYPE)+1,LOCATE(')',COLUMN_TYPE)-LOCATE('(',COLUMN_TYPE)-1) AS Length, CAST(SUBSTRING(COLUMN_TYPE,LOCATE('(',COLUMN_TYPE)+1,LOCATE(')',COLUMN_TYPE)-LOCATE('(',COLUMN_TYPE)-1) AS signed) AS Length,
column_default AS `DefaultValue`, column_default AS `DefaultValue`,
column_comment AS `ColumnDescription`, column_comment AS `ColumnDescription`,
CASE WHEN COLUMN_KEY = 'PRI' CASE WHEN COLUMN_KEY = 'PRI'