CoreCraft.Storage.Sqlite
0.6.2-preview
See the version list below for details.
dotnet add package CoreCraft.Storage.Sqlite --version 0.6.2-preview
NuGet\Install-Package CoreCraft.Storage.Sqlite -Version 0.6.2-preview
<PackageReference Include="CoreCraft.Storage.Sqlite" Version="0.6.2-preview" />
paket add CoreCraft.Storage.Sqlite --version 0.6.2-preview
#r "nuget: CoreCraft.Storage.Sqlite, 0.6.2-preview"
// Install CoreCraft.Storage.Sqlite as a Cake Addin #addin nuget:?package=CoreCraft.Storage.Sqlite&version=0.6.2-preview&prerelease // Install CoreCraft.Storage.Sqlite as a Cake Tool #tool nuget:?package=CoreCraft.Storage.Sqlite&version=0.6.2-preview&prerelease
<p align="center"> <img src="images/logo.png" width="15%" /> </p>
Introduction
CoreCraft
is a comprehensive toolkit designed to simplify domain modeling and data management in .NET applications. It offers a range of powerful features and functionalities that enable developers to build robust and scalable domain models.
Main Features
The CoreCraft
provides a wealth of features, including:
Automatic Domain Model Generation with Roslyn Source Generators:
CoreCraft
leverages Roslyn Source Generators to automatically generate domain models based on your schema. This automated process eliminates the need for manual coding, saving you time and effort. The generated models are accurate, consistent, and reflect the structure of your schema.Change Tracking:
CoreCraft
incorporates change tracking mechanisms that allow you to monitor modifications to your domain model. By tracking changes at a granular level,CoreCraft
notifies you of specific modifications, enabling you to respond effectively. This feature eliminates the need for manual change detection and parsing of the entire model.Undo/Redo Support:
CoreCraft
simplifies the implementation of undo and redo operations in your application. It provides built-in support for managing and reverting changes, giving users the ability to undo actions and redo them as needed.Data integrity:
CoreCraft
follows a command-based execution approach, where the domain model is read-only by default, and modifications are made through commands. When a command executes, it operates on a snapshot of the model, ensuring data integrity in case of exceptions during command execution.Persistence Options:
CoreCraft
offers seamless support for persisting your generated domain model. WithCoreCraft
, there's no need for additional code to handle persistence. It supports saving and loading the model's state to a SQLite database and JSON files. The toolkit takes care of the storage and retrieval process, making it convenient and hassle-free. Additionally,CoreCraft
allows for easy implementation of additional storage options, making it flexible to adapt to your specific requirements.Plugin Architecture Support:
CoreCraft
is well-suited for use in a plugin architecture. It provides the necessary abstractions and features to support modular development, allowing different plugins to contribute to the overall application state.Reactive Extensions (Rx.NET) Integration:
CoreCraft
incorporates Reactive Extensions (Rx.NET) to provide a flexible subscription mechanism. It utilizes theIObservable
andIObserver
interfaces, allowing you to leverage the power of Rx.NET for event-driven programming and reactive data processing. This integration enables you to easily subscribe to change events and apply custom logic using the extensive set of operators provided byRx.NET
.
CoreCraft
empowers developers to create robust and scalable domain models with ease. With automatic model generation, change tracking, persistence options, and support for undo/redo operations, CoreCraft
simplifies application state management and enhances the user experience.
NuGet Packages
CoreCraft is distributed as NuGet packages.
Package | Status |
---|---|
CoreCraft | |
CoreCraft.Generators | |
CoreCraft.Storage.SQLite | |
CoreCraft.Storage.Json |
Basic usage
The only thing is needed to start using the CoreCraft
toolkit is to define the schema for the domain model. Create a *.model.json
file that describes your entities, properties and their relations. Here's an example:
{
"shards": [
{
"name": "ToDo",
"entities": [
{
"name": "ToDoItem",
"properties": [
{ "name": "Name", "type": "string", "defaultValue": "string.Empty" }
]
}
],
"collections": [{ "name": "Items", "entityType": "ToDoItem" }],
"relations": []
}
]
}
And add the additional files entry to the project file:
<ItemGroup>
<AdditionalFiles Include="Model.model.json" />
</ItemGroup>
The model schema is the only piece needed to define data of your domain model. Everything else will be automatically generated by the CoreCraft.Generators
package.
Now, an instance of the domain model can be created using an instance of generated ToDoModelShard
class:
// Create an instance of the domain model
var model = new DomainModel(new[] { new ToDoModelShard() });
Note: instead of using
DomainModel
class directly, you can use build-in classes (AutoSaveDomainModel
,UndoRedoDomainModel
) or inherit from it and implement custom logic
Then we need to subscribe to the model changes by providing an event handler method to handle the collection changes.:
// Subscribe to Items collection change events
using var subscription = model.For<IToDoChangesFrame>()
.With(x => x.Items)
.Subscribe(OnItemChanged);
// Observe changes
void OnItemChanged(Change<ICollectionChangeSet<ToDoItem, ToDoItemProperties>> changes)
{
foreach (var c in changes.Hunk)
{
Console.WriteLine($"Entity [{c.Entity}] has been {c.Action}ed.");
Console.WriteLine($" Old data: {c.OldData}");
Console.WriteLine($" New data: {c.NewData}");
}
}
When subscription is done, let's execute a command to modify the model:
// Adds new item to the collection
model.Run<IMutableToDoModelShard>(
(shard, _) => shard.Items.Add(new() { Name = "test" }));
Save the domain model to an SQLite database file.
var storage = new SqliteStorage("my_data.db", Array.Empty<IMigration>());
model.Save(storage);
Please refer to the documentation for comprehensive information on using the CoreCraft
toolkit and its features.
License
MIT.
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 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- CoreCraft (>= 0.6.2-preview)
- Microsoft.Data.Sqlite (>= 7.0.10)
-
net8.0
- CoreCraft (>= 0.6.2-preview)
- Microsoft.Data.Sqlite (>= 7.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.7.0 | 158 | 6/15/2024 |
0.6.16-preview | 102 | 6/7/2024 |
0.6.15-preview | 78 | 6/7/2024 |
0.6.14-preview | 81 | 6/4/2024 |
0.6.13-preview | 93 | 5/30/2024 |
0.6.12-preview | 91 | 5/26/2024 |
0.6.11-preview | 102 | 4/16/2024 |
0.6.10-preview | 97 | 4/14/2024 |
0.6.9-preview | 94 | 3/23/2024 |
0.6.8-preview | 100 | 3/19/2024 |
0.6.7-preview | 89 | 3/17/2024 |
0.6.6-preview | 88 | 2/25/2024 |
0.6.5-preview | 109 | 2/17/2024 |
0.6.4-preview | 97 | 2/16/2024 |
0.6.3-preview | 85 | 2/15/2024 |
0.6.2-preview | 110 | 2/9/2024 |
0.6.1-preview | 144 | 12/30/2023 |
0.6.0 | 154 | 10/3/2023 |
0.5.6-preview | 115 | 10/2/2023 |
0.5.5-preview | 106 | 9/24/2023 |
0.5.4-preview | 123 | 9/9/2023 |
0.5.3-preview | 104 | 9/3/2023 |
0.5.2-preview | 118 | 9/3/2023 |
0.5.1-preview | 141 | 7/22/2023 |
0.5.0 | 175 | 7/22/2023 |
0.5.0-preview | 122 | 6/30/2023 |