Browse Source

Support custom database

pull/14/head
sunkaixuna 3 years ago
parent
commit
f4092607c9
  1. 5
      Src/Asp.Net/SqlSugar/Enum/DbType.cs
  2. 14
      Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs
  3. 16
      Src/Asp.Net/SqlSugar/Realization/Custom/CustomProvider.cs
  4. 1
      Src/Asp.Net/SqlSugar/SqlSugar.csproj

5
Src/Asp.Net/SqlSugar/Enum/DbType.cs

@ -14,6 +14,9 @@ namespace SqlSugar
PostgreSQL, PostgreSQL,
Dm, Dm,
Kdbndp, Kdbndp,
Oscar Oscar,
MySqlConnector,
Access,
Custom=900
} }
} }

14
Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs

@ -25,13 +25,25 @@ namespace SqlSugar
{ {
return new SqlServerQueryable<T>(); return new SqlServerQueryable<T>();
} }
else if (currentConnectionConfig.DbType == DbType.MySql) else if (currentConnectionConfig.DbType == DbType.MySql)
{ {
return new MySqlQueryable<T>(); return new MySqlQueryable<T>();
} }
else if (currentConnectionConfig.DbType == DbType.PostgreSQL) else if (currentConnectionConfig.DbType == DbType.PostgreSQL)
{ {
return new PostgreSQLQueryable<T>(); return new PostgreSQLQueryable<T>();
}
else if (currentConnectionConfig.DbType == DbType.MySqlConnector)
{
return CustomProvider.GetQueryable<T>("MySql", "SqlSugar.MySqlConnector");
}
else if (currentConnectionConfig.DbType == DbType.Access)
{
return CustomProvider.GetQueryable<T>("MySql", "SqlSugar.Access");
}
else if (currentConnectionConfig.DbType == DbType.Custom)
{
return CustomProvider.GetQueryable<T>("DbType.Custom", "DbType.Custom");
} }
else else
{ {

16
Src/Asp.Net/SqlSugar/Realization/Custom/CustomProvider.cs

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
public class CustomProvider
{
internal static ISugarQueryable<T> GetQueryable<T>(string dbName, string dllName)
{
throw new NotImplementedException();
}
}
}

1
Src/Asp.Net/SqlSugar/SqlSugar.csproj

@ -102,6 +102,7 @@
<Compile Include="Interface\IFastBuilder.cs" /> <Compile Include="Interface\IFastBuilder.cs" />
<Compile Include="Interface\IFastest.cs" /> <Compile Include="Interface\IFastest.cs" />
<Compile Include="OnlyNet\OracleFastBuilder.cs" /> <Compile Include="OnlyNet\OracleFastBuilder.cs" />
<Compile Include="Realization\Custom\CustomProvider.cs" />
<Compile Include="Realization\MySql\SqlBuilder\MySqlFastBuilder.cs" /> <Compile Include="Realization\MySql\SqlBuilder\MySqlFastBuilder.cs" />
<Compile Include="Realization\PostgreSQL\SqlBuilder\PostgreSQLFastBuilder.cs" /> <Compile Include="Realization\PostgreSQL\SqlBuilder\PostgreSQLFastBuilder.cs" />
<Compile Include="Realization\Sqlite\SqlBuilder\SqliteFastBuilder.cs" /> <Compile Include="Realization\Sqlite\SqlBuilder\SqliteFastBuilder.cs" />

Loading…
Cancel
Save