SqliteDbContext 1.4.0
dotnet add package SqliteDbContext --version 1.4.0
NuGet\Install-Package SqliteDbContext -Version 1.4.0
<PackageReference Include="SqliteDbContext" Version="1.4.0" />
paket add SqliteDbContext --version 1.4.0
#r "nuget: SqliteDbContext, 1.4.0"
// Install SqliteDbContext as a Cake Addin #addin nuget:?package=SqliteDbContext&version=1.4.0 // Install SqliteDbContext as a Cake Tool #tool nuget:?package=SqliteDbContext&version=1.4.0
SqliteDbContext Entity Generator
<p> This project helps to encapsulate logic for randomly generating a valid entity in an Entity Framework DB Context.<br /> The user only has to define the relationship with PKs, FKs, and PKs that are contrainted as FKs as well. <br /> This project also references <a href="https://github.com/skenneth/AutoPopulate.git"> AutoPopulate</a> project which has yet to become a Nuget Package. </p> <br /> <h1>How it works</h1> <p> <ol> <li> Autopopulate library crawls through properties of a generated instance and references a dictionary<ClassType:PropertyName, Func<PropertyType>> which calls the appropriate Function to assign the value. In this case, each function uses AutoFake library's randomization functionality for each property's type. </li> <li> Once the item is generated, all class refernces are set to null. Due to EFCore's DBContext's tracking, an exception can be thrown if the FK's id doesn't match the corresponding referenced instance's PK. This built-in logic helps to enforce relationship FK-constraints. So these are set to null, so that once items are added and saved, then the tracked FK reference will be supplied. </li> <li> All PKs and FKs are reset to -1 for short, int, long, null (string) so that these values will be tracked via a IKeySeeder helper when the user utilizes this interface to perform auto-increment on PKs or generate a random ID from FKs. The key seeder is not limited to a single PK and FK, but instead the set of PKs that are defined by the table schema. </li> <li> To make this robust and convenient, the user can create custom entities to add/updat. These action will be applied at this stage. Several conditions will be considered whe adding/updating with respect to previous operations such as auto-generation or custom entity. </li> <li> Once entity has been added/updated, the user's dependency resolution will be executed. This is primarly how the keys are generated. </li> <li> Finally, after all validation and dependencies are resolved, then the entity will be added/updated. A user can generate a random entity, or create N entities with ease, only worrying about establishing the foreign key constraints. </li> </ol> </p> <p> Refer to the sample test cases provided for more context </p>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- AutoPopulate (>= 1.3.1)
- Bogus (>= 35.6.1)
- Microsoft.EntityFrameworkCore (>= 8.0.13)
- Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.13)
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.13)
- Newtonsoft.Json (>= 13.0.3)
- sqlite-net-pcl (>= 1.9.172)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.