Lpslsn.Net.Core.Data.Manager
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Lpslsn.Net.Core.Data.Manager --version 1.0.2
NuGet\Install-Package Lpslsn.Net.Core.Data.Manager -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lpslsn.Net.Core.Data.Manager" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lpslsn.Net.Core.Data.Manager" Version="1.0.2" />
<PackageReference Include="Lpslsn.Net.Core.Data.Manager" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lpslsn.Net.Core.Data.Manager --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lpslsn.Net.Core.Data.Manager, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lpslsn.Net.Core.Data.Manager@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lpslsn.Net.Core.Data.Manager&version=1.0.2
#tool nuget:?package=Lpslsn.Net.Core.Data.Manager&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Usage
/*
// *********************************************Create your own provider example Oracle
---------Nuget packages required:
Lpslsn.Net.Core.Data.Manager.IDataProvider
Microsoft.Windows.Compatibility
Oracle.ManagedDataAccess.Core --> this is managed provider for oracle and you can use any other core providers
using System.Data;
using System.ComponentModel.Composition;
using Lpslsn.Net.Core.Data.Manager.Providers;
using Lpslsn.Net.Core.Data.Manager.Providers.DbUtils;
using System.Data.Common;
using Oracle.ManagedDataAccess.Client;
using System.Linq;
using System;
namespace My.Oracle.Provider
{
[Export(typeof(IDataProvider))]
public class OracleProvider : IDataProvider
{
public string PROVIDER_NAME
{
get
{
return "ORACLE_PROVIDER";-->This is important in order to properly load the provider at runtime
}
}
public DbCommand GetNewCommand()
{
return new OracleCommand();
}
public DbConnection GetNewConnection()
{
return new OracleConnection();
}
public DbParameter GetNewParameter()
{
return new OracleParameter();
}
public string CommandParameterSymbol
{
get { return ":"; }
}
public string ParamPrefix
{
get { return ":"; }
}
public void ImportCustomBulkData(string destinationTbName, ref DataTable sourceTable, IDbConnection destConnection, ref string[] columnsToSkip, int BatchSize = 1000)
{
try
{
if (string.IsNullOrWhiteSpace(sourceTable.TableName))
{
sourceTable.TableName = " /*+ APPEND NOLOGGING */ " + destinationTbName;
}
if (destConnection.State == ConnectionState.Closed)
{
destConnection.Open();
}
int recCount = sourceTable.Rows.Count;
GenerateBulkInsertFromDataTable _gen = new GenerateBulkInsertFromDataTable(sourceTable, destConnection, columnsToSkip.ToList(), ":", false,PROVIDER_TYPE.ORACLE);//THE DEFAULT TRANSACTION FALSE , PROVIDER ORACLE
_gen.ExecuteInsertTable(BatchSize, (cmd)=> {//CALL-BACK FUNCTION TO CHANGE THE COMMAND BEFORE RUNNING IT. NOT MANDATORY
((OracleCommand)cmd).BindByName = true;
((OracleCommand)cmd).ArrayBindCount = recCount;
});
}
catch (Exception Ex)
{
throw Ex;
}
}
}
}
// ********************************************* Configure the folder for the providers extensions and put the assemblies inside to load the provider dynamically at run time
DataProviderExtensions (folder)
- runtimes
- Lpslsn.Net.Core.Data.Manager.IDataProvider.dll
- Oracle.ManagedDataAccess.dll
- MyOracleProvider.dll
Note: In your application, you can configure another position by appsettings.json:
"LpslsnDataManager":
{
"DataProvidersPath": "D:\\User\\MyProviderExtensions"
}
*/
// ********************************************* Use DBProvider in your Application
---------Nuget packages required:
Lpslsn.Net.Core.Data.Manager
DBProvider db = null;
try
{
db = new DBProvider(DataProvider.Custom, @"DATA SOURCE=IP/ORCL:1252;PASSWORD=PWD;USER ID=USER", "ORACLE_PROVIDER");
db.Open();
DataSet ds = db.ExecuteDataSet(System.Data.CommandType.Text, "Select * from MyTable");
foreach (DataRow r in ds.Tables[0].Rows)
{
foreach (DataColumn c in ds.Tables[0].Columns)
{
Console.WriteLine(c.ColumnName + " - " + r[c] + "");
}
}
}
catch(Exception e)
{
throw e;
}
finally
{
if(db != null)
db.Close();
}
//OR
DBProvider db = null;
try
{
db = new DBProvider(DataProvider.Custom, @"DATA SOURCE=IP-HOST/ORCL:1252;PASSWORD=PWD;USER ID=USER", "ORACLE_PROVIDER");
db.Open();
IDataReader r = db.ExecuteReader(System.Data.CommandType.Text, "Select * from MyTable");
while(r.Read())
{
Console.WriteLine("Data :" + r["MyColum"]);
}
}
catch (Exception e)
{
throw e;
}
finally
{
if (db != null)
db.Close();
}
// UPDATE WITH TRANSACTION
DBProvider db = null;
try
{
db = new DBProvider(DataProvider.Custom, @"DATA SOURCE=HOST-IP/ORCL:1252;PASSWORD=password;USER ID=user", "ORACLE_PROVIDER");
db.Open();
db.BeginTransaction();
db.AddParameters("NAME", "HELLO");
db.AddParameters("UNIQUE_ID", "1234567");
db.ExecuteNonQuery(System.Data.CommandType.Text, "UPDATE MYTABLE SET NAME = :NAME WHERE UNIQUE_ID = :UNIQUE_ID");
db.CommitTransaction();
}
catch (Exception e)
{
if (db != null)
db.RollBackTransaction();
throw e;
}
finally
{
if (db != null)
db.Close();
}
//DEFAULT SQLSERVER WITHOUT CUSTOM PROVIDER
DBProvider db = null;
try
{
db = new DBProvider(DataProvider.SqlServer, @"Data Source=HOST;Initial Catalog=MYDATABASE;Persist Security Info=True;User ID=user;Password=password");
db.Open();
db.BeginTransaction();
db.AddParameters("UserID", "a.lippolis");
db.AddParameters("Id", 371);
db.ExecuteNonQuery(System.Data.CommandType.Text, "UPDATE dbo.MyTable SET UserID = @UserID WHERE Id = @Id");
db.CommitTransaction();
}
catch (Exception e)
{
if (db != null)
db.RollBackTransaction();
throw e;
}
finally
{
if (db != null)
db.Close();
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- Lpslsn.Net.Core.Data.Manager.IDataProvider (>= 1.0.4)
- Lpslsn.Net.Core.Text.Tokenizer (>= 1.0.1)
- Microsoft.Extensions.Configuration (>= 3.1.4)
- Microsoft.Extensions.Configuration.FileExtensions (>= 3.1.4)
- Microsoft.Extensions.Configuration.Json (>= 3.1.4)
- Microsoft.Extensions.FileProviders.Abstractions (>= 3.1.4)
- Microsoft.Windows.Compatibility (>= 3.1.0)
- Newtonsoft.Json (>= 12.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Update to Lpslsn.Net.Core.Data.Manager.IDataProvider 1.0.4