Kimtoo.DbContext
1.0.2
dotnet add package Kimtoo.DbContext --version 1.0.2
NuGet\Install-Package Kimtoo.DbContext -Version 1.0.2
<PackageReference Include="Kimtoo.DbContext" Version="1.0.2" />
paket add Kimtoo.DbContext --version 1.0.2
#r "nuget: Kimtoo.DbContext, 1.0.2"
// 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 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");