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. 12
      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,
Dm,
Kdbndp,
Oscar
Oscar,
MySqlConnector,
Access,
Custom=900
}
}

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

@ -33,6 +33,18 @@ namespace SqlSugar
{
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
{
string className = "Queryable";

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\IFastest.cs" />
<Compile Include="OnlyNet\OracleFastBuilder.cs" />
<Compile Include="Realization\Custom\CustomProvider.cs" />
<Compile Include="Realization\MySql\SqlBuilder\MySqlFastBuilder.cs" />
<Compile Include="Realization\PostgreSQL\SqlBuilder\PostgreSQLFastBuilder.cs" />
<Compile Include="Realization\Sqlite\SqlBuilder\SqliteFastBuilder.cs" />

Loading…
Cancel
Save