DbModelFramework.MsSql
1.3.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DbModelFramework.MsSql --version 1.3.2
NuGet\Install-Package DbModelFramework.MsSql -Version 1.3.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="DbModelFramework.MsSql" Version="1.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DbModelFramework.MsSql --version 1.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DbModelFramework.MsSql, 1.3.2"
#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 DbModelFramework.MsSql as a Cake Addin #addin nuget:?package=DbModelFramework.MsSql&version=1.3.2 // Install DbModelFramework.MsSql as a Cake Tool #tool nuget:?package=DbModelFramework.MsSql&version=1.3.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DbModelFramework
Getting started
Environment
Download NuGet-Package
Inject InjectionContainer
As a minimum requirement you have to define a new injection container with at least a DbRequirements class as a part. You can use one of the predifined DbRequirements (DbModelFramework.Sqlite, DbModelFramework.MySql, DbModelFramework.MsSql). The DbRequirements class has to export the type DbModelFramework.DbRequirements.
Your DbRequirements class:
[Export(typeof(DbModelFramework.DbRequirements))]
class DbRequirements : DbModelFramework.Sqlite.DbRequirements
{
private static readonly string ConnectionString = new SqliteConnectionStringBuilder { DataSource = "database.db" }.ConnectionString;
public override IDbConnection CreateDbConnection()
{
var connection = new SqliteConnection(ConnectionString);
connection.Open();
return connection;
}
}
Injection container creation (System.Composition is required):
var configuration = new ContainerConfiguration();
configuration.WithPart<DbRequirements>();
DbModelFramework.DependencyInjection.InjectionContainer = configuration.CreateContainer();
Use the models
Define a new model class
class MyModel : Model<MyModel>
{
public string Property1 { get; set; }
public string Property2 { get; set; }
}
Create a new model instance (insert in db)
var myModel = MyModel.Create();
Get all model data
var myModels = MyModel.Get();
Get all model data which fits in the condition
var myModels = MyModel.Get(model => model.Property1 == "MyValue");
Get model data by primary key
var myModel = MyModel.Get(1); // Get model data with primary key 1
Save changes of a models data (update in db)
myModel.Save();
Delete model data (delete from db)
myModel.Delete();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.0
- DbModelFramework (>= 1.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.