Kimtoo.DbContext 1.0.2

.NET Framework 4.5
dotnet add package Kimtoo.DbContext --version 1.0.2
NuGet\Install-Package Kimtoo.DbContext -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="Kimtoo.DbContext" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kimtoo.DbContext --version 1.0.2
#r "nuget: Kimtoo.DbContext, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kimtoo.DbContext as a Cake Addin
#addin nuget:?package=Kimtoo.DbContext&version=1.0.2

// Install Kimtoo.DbContext as a Cake Tool
#tool nuget:?package=Kimtoo.DbContext&version=1.0.2
using ServiceStack.OrmLite;
using Kimtoo.ServicestackContext;
 

/**Create a connection**/

//This creates default connecton
 var err = Db.Init(@"Server=EXRESS\LOCALHOST;Database=DatabaseName;Trusted_Connection=True;", SqlServerDialect.Provider);

// if connection fails, It returns an exception
   if (err != null)  MessageBox.Show(err.Message);


//Get the default connetion
  var db = Db.Get();

  
/**Named Instances**/

//You can run multiple instances of databases  using names     
  var err = Db.Init(@"Server=EXPRESS\SERVER;Database=DatabaseName;Trusted_Connection=True;", SqlServerDialect.Provider,"database2");       
 
//Get the connetion
  var db2 = Db.Get("database2");

/**Remove a connection**/
//this will close and remove the default connection, returns exception if it fails
Db.Close();
//this will close and remove the named connection, returns exception if it fails
Db.Close("database2");

Product Versions
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 483 10/29/2021
1.0.1 206 10/29/2021
1.0.0 170 10/29/2021

using ServiceStack.OrmLite;
using Kimtoo.ServicestackContext;

...

/**Create a connection**/

//This creates default connecton
var err = Db.Init(@"Server=EXRESS\LOCALHOST;Database=DatabaseName;Trusted_Connection=True;", SqlServerDialect.Provider);

// if connection fails, It returns an exception
  if (err != null)  MessageBox.Show(err.Message);


//Get the default connetion
 var db = Db.Get();

 
/**Named Instances**/

//You can run multiple instances of databases  using names     
 var err = Db.Init(@"Server=EXPRESS\SERVER;Database=DatabaseName;Trusted_Connection=True;", SqlServerDialect.Provider,"database2");       

//Get the connetion
 var db2 = Db.Get("database2");

/**Remove a connection**/
//this will close and remove the default connection, returns exception if it fails
Db.Close();
//this will close and remove the named connection, returns exception if it fails
Db.Close("database2");