Browse Source

Update Core

pull/10/head
sunkaixuna 3 years ago
parent
commit
121e4690b3
  1. 4
      Src/Asp.Net/SqlSugar/Abstract/FastestProvider/Private.cs
  2. 4
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/FastestProvider/Private.cs
  3. 39
      Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/Oracle/SqlBuilder/OracleFastBuilder.cs

4
Src/Asp.Net/SqlSugar/Abstract/FastestProvider/Private.cs

@ -41,11 +41,11 @@ namespace SqlSugar
{
if (AsName == null)
{
return queryable.Where(it => false).ToDataTable();
return queryable.Where(it => false).Select("*").ToDataTable();
}
else
{
return queryable.AS(AsName).Where(it => false).ToDataTable();
return queryable.AS(AsName).Where(it => false).Select("*").ToDataTable();
}
}
);

4
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/FastestProvider/Private.cs

@ -41,11 +41,11 @@ namespace SqlSugar
{
if (AsName == null)
{
return queryable.Where(it => false).ToDataTable();
return queryable.Where(it => false).Select("*").ToDataTable();
}
else
{
return queryable.AS(AsName).Where(it => false).ToDataTable();
return queryable.AS(AsName).Where(it => false).Select("*").ToDataTable();
}
}
);

39
Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Realization/Oracle/SqlBuilder/OracleFastBuilder.cs

@ -1,4 +1,5 @@
using System;
using Oracle.ManagedDataAccess.Client;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
@ -8,9 +9,43 @@ namespace SqlSugar
{
public class OracleFastBuilder : FastBuilder, IFastBuilder
{
private OracleBulkCopy GetBulkCopyInstance()
{
if (this.Context.Ado.Connection.State == ConnectionState.Closed)
{
this.Context.Ado.Connection.Open();
}
OracleBulkCopy copy;
if (this.Context.Ado.Transaction == null)
{
copy = new OracleBulkCopy((OracleConnection)this.Context.Ado.Connection, Oracle.ManagedDataAccess.Client.OracleBulkCopyOptions.Default);
}
else
{
copy = new OracleBulkCopy((OracleConnection)this.Context.Ado.Connection, OracleBulkCopyOptions.UseInternalTransaction);
}
return copy;
}
public Task<int> ExecuteBulkCopyAsync(DataTable dt)
{
throw new NotImplementedException();
OracleBulkCopy copy = GetBulkCopyInstance();
try
{
copy.DestinationTableName = dt.TableName;
copy.WriteToServer(dt);
}
catch (Exception ex)
{
throw ex;
}
finally
{
CloseDb();
}
return Task.FromResult(dt.Rows.Count);
}
}
}

Loading…
Cancel
Save