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 |
---|---|
.NET Framework | net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
-
- 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");