private void DefineSqlAdapter(SqlAdapterType sqlAdapterType, Type typeTable, SqlBuilderFormatting formatting, string tableAlias) { var sqlAdapter = GetInstanceSqlAdapter(sqlAdapterType); _sqlQueryBuilder = new FluentSqlQueryBuilder(sqlAdapter, typeTable, formatting, null, tableAlias); _resolver = new LambdaResolver(_sqlQueryBuilder, tableAlias); }
//private static readonly Dictionary<SqlAdapterType, ISqlBulk> BulkPluginDict=new Dictionary<SqlAdapterType, ISqlBulk>(); public static ISqlAdapter GetAdapterInstance(SqlAdapterType adapter) { switch (adapter) { case SqlAdapterType.SqlServer: return(new SqlserverAdapter()); case SqlAdapterType.Sqlite: return(new Sqlite3Adapter()); case SqlAdapterType.Oracle: return(new OracleAdapter()); case SqlAdapterType.MySql: return(new MySqlAdapter()); case SqlAdapterType.Postgres: return(new PostgresAdapter()); case SqlAdapterType.SqlAnyWhere: return(new SqlAnyWhereAdapter()); case SqlAdapterType.SqlServerCE: return(new SqlserverCEAdapter()); default: throw new ArgumentException("The specified Sql Adapter was not recognized"); } }
private static ISqlBuilderFluentAdapter GetInstanceSqlAdapter(SqlAdapterType sqlAdapterType) { ISqlBuilderFluentAdapter sqlAdapter; switch (sqlAdapterType) { case SqlAdapterType.SqlServer2008: sqlAdapter = new SqlServer2008Adapter(); break; case SqlAdapterType.SqlServer2012: case SqlAdapterType.SqlServer2014: case SqlAdapterType.SqlServer2016: case SqlAdapterType.SqlServer2017: case SqlAdapterType.SqlServer2019: sqlAdapter = new SqlServerGreaterEqual2012Adapter(); break; case SqlAdapterType.MySql: sqlAdapter = new MySqlAdapter(); break; default: throw new SqlBuilderException("'SqlAdapterType' not defined"); } return(sqlAdapter); }
public SqlExpBase(SqlAdapterType adater, SqlTableDefine tableDefine, List <SqlColumnDefine> columnDefines) { _type = SqlType.Query; _adapter = adater; _builder = new Builder.Builder(_type, tableDefine, columnDefines, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
public SqlExpBase(SqlAdapterType adater, Type entityType) { _type = SqlType.Query; _adapter = adater; _entityType = entityType; _builder = new Builder.Builder(_type, entityType, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
public SqlExp(SqlAdapterType type = SqlAdapterType.SqlServer, bool forCount = false, string specialSchema = null) : base(type, typeof(T), specialSchema) { useForCount = forCount; _type = SqlType.Query; //GetAdapterInstance(type); //_builder = new Builder(_type, LambdaResolver.GetTableName<T>(), _defaultAdapter); //_resolver = new LambdaResolver(_builder); }
public SqlExpBase(SqlAdapterType adater, Type entityType, string specialSchema) { _type = SqlType.Query; _adapter = adater; _entityType = entityType; SqlAdapter = AdapterFactory.GetAdapterInstance(_adapter); _builder = new Builder.Builder(_type, entityType, SqlAdapter, specialSchema); //_builder = new Builder.Builder(_type, entityType, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
public SqlExp(SqlTableDefine tableDefine, List <SqlColumnDefine> columnDefines, SqlAdapterType type = SqlAdapterType.SqlServer, bool forCount = false) : base(type, tableDefine, columnDefines) { useForCount = forCount; _type = SqlType.Query; //GetAdapterInstance(type); //_builder = new Builder(_type, LambdaResolver.GetTableName<T>(), _defaultAdapter); //_resolver = new LambdaResolver(_builder); }
public FluentSqlBuilder(SqlAdapterType sqlAdapterType, SqlBuilderFormatting formatting = SqlBuilderFormatting.None, string tableAlias = null) { DefineSqlAdapter(sqlAdapterType, typeof(TTable), formatting, tableAlias); DefineTargetToSelect(TargetToSelect.Common); DefineExtension(); }
public void SetAdapter(SqlAdapterType adapter) { _builder.Adapter = AdapterFactory.GetAdapterInstance(adapter); }