mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-06 05:37:58 +08:00
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using SugarCodeGeneration.Codes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
namespace SugarCodeGeneration
|
|
{
|
|
class Program
|
|
{
|
|
private const SqlSugar.DbType sqlServer = SqlSugar.DbType.SqlServer;
|
|
private const string projectName = "SugarCodeGeneration";
|
|
private const string classPath= projectName + @"\Models";
|
|
private const string classNamespace = "MyTest";
|
|
private const string connectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
//Generation model
|
|
SqlSugar.SqlSugarClient db = new SqlSugar.SqlSugarClient(new SqlSugar.ConnectionConfig() {
|
|
DbType = sqlServer,
|
|
ConnectionString = connectionString,
|
|
IsAutoCloseConnection = true
|
|
});
|
|
var classDirectory = Methods.GetSlnPath +"\\"+ classPath.TrimStart('\\');
|
|
|
|
//if all then remove .Where
|
|
db.DbFirst.Where("Student","School").CreateClassFile(classDirectory, classNamespace);
|
|
|
|
//Methods.AddCsproj(classDirectory, projectName);
|
|
|
|
//Generation DbContext
|
|
}
|
|
}
|
|
}
|