You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1011 B
C#

// See https://aka.ms/new-console-template for more information
using SqlSugar;
using System.Data;
Console.WriteLine("------SqlSugar生成实体对象~~");
try
{
var connetctionlist = new List<SlaveConnectionConfig>()
{
//第一个从库
new SlaveConnectionConfig(){
HitRate=10,
ConnectionString="Data Source=rbs_server_db.db"
}
};
ConnectionConfig connectionConfig1 = new ConnectionConfig()
{
DbType = SqlSugar.DbType.Sqlite,
ConnectionString = "Data Source=rbs_server_db.db",
InitKeyType = InitKeyType.Attribute,
//IsAutoCloseConnection = true,
//SlaveConnectionConfigs = connetctionlist
};
using (ISqlSugarClient client = new SqlSugarClient(connectionConfig1))
{
//一、基于数据库生成实体对象--DbFirst
{
client.DbFirst.CreateClassFile(@"..\..\..\myModels");
}
}
}
catch (Exception)
{
throw;
}