配置文件开关,数据库读写分离
This commit is contained in:
16
Yi.Framework/Yi.Framework.Common/Const/DbConst.cs
Normal file
16
Yi.Framework/Yi.Framework.Common/Const/DbConst.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Common.Const
|
||||
{
|
||||
public class DbConst
|
||||
{
|
||||
public const string Mysql = "Mysql";
|
||||
public const string Sqlite = "Sqlite";
|
||||
public const string Sqlserver = "Sqlserver";
|
||||
public const string Oracle = "Oracle";
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yi.Framework.Common.IOCOptions
|
||||
{
|
||||
public class MySqlConnOptions
|
||||
public class DbConnOptions
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string WriteUrl { get; set; }
|
||||
public List<string> ReadUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Yi.Framework.Common.IOCOptions
|
||||
{
|
||||
public class SqliteOptions
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string WriteUrl { get; set; }
|
||||
public List<string> ReadUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Yi.Framework.Common.Enum
|
||||
{
|
||||
public enum WriteAndReadEnum
|
||||
{
|
||||
Write, //主库操作
|
||||
Read //从库操作
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user