Kimtoo.DbContext
1.0.1
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
<PackageReference Include="Kimtoo.DbContext" Version="1.0.1" />
paket add Kimtoo.DbContext --version 1.0.1
#r "nuget: Kimtoo.DbContext, 1.0.1"
// 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 | Versions 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. |
-
- ServiceStack.OrmLite (>= 5.12.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
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");