Kimtoo.DbContext 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Kimtoo.DbContext --version 1.0.1                
NuGet\Install-Package Kimtoo.DbContext -Version 1.0.1                
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.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kimtoo.DbContext --version 1.0.1                
#r "nuget: Kimtoo.DbContext, 1.0.1"                
#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.
// Install Kimtoo.DbContext as a Cake Addin
#addin nuget:?package=Kimtoo.DbContext&version=1.0.1

// Install Kimtoo.DbContext as a Cake Tool
#tool nuget:?package=Kimtoo.DbContext&version=1.0.1                

A singleton  database instance manager for service stack ormlite.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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 1,017 10/29/2021
1.0.1 330 10/29/2021
1.0.0 277 10/29/2021 1.0.0 is deprecated because it is no longer maintained and has critical bugs.

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");