{"id":13629108,"url":"https://github.com/AlexNav73/CoreCraft","last_synced_at":"2025-04-17T04:33:04.310Z","repository":{"id":53937788,"uuid":"467639000","full_name":"AlexNav73/CoreCraft","owner":"AlexNav73","description":"A domain model builder and generator","archived":false,"fork":false,"pushed_at":"2024-04-16T20:34:42.000Z","size":911,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-23T07:52:29.198Z","etag":null,"topics":["builder","csharp-library","csharp-sourcegenerator","domain","generator","sqlite"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexNav73.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-08T18:56:38.000Z","updated_at":"2024-05-30T17:13:15.400Z","dependencies_parsed_at":"2024-01-06T09:54:14.141Z","dependency_job_id":"9a8cfda4-7fe0-49f1-946d-819cf098b492","html_url":"https://github.com/AlexNav73/CoreCraft","commit_stats":null,"previous_names":["alexnav73/navitski.crystalized"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexNav73%2FCoreCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexNav73%2FCoreCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexNav73%2FCoreCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexNav73%2FCoreCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexNav73","download_url":"https://codeload.github.com/AlexNav73/CoreCraft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249316055,"owners_count":21249884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builder","csharp-library","csharp-sourcegenerator","domain","generator","sqlite"],"created_at":"2024-08-01T22:01:02.643Z","updated_at":"2025-04-17T04:33:02.070Z","avatar_url":"https://github.com/AlexNav73.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/logo.png\" width=\"15%\" /\u003e\n\u003c/p\u003e\n\n[![build](https://github.com/AlexNav73/CoreCraft/workflows/releasing/badge.svg)](https://github.com/AlexNav73/CoreCraft/actions)\n[![codecov](https://codecov.io/gh/AlexNav73/CoreCraft/branch/master/graph/badge.svg?token=Q6ZY0WHL9J)](https://codecov.io/gh/AlexNav73/CoreCraft) ![Nuget](https://img.shields.io/nuget/dt/CoreCraft) ![GitHub](https://img.shields.io/github/license/AlexNav73/CoreCraft)\n\n## Introduction\n\n`CoreCraft` is a library that simplifies application state management. With automatic code generation, change tracking, and undo/redo support, you can focus on building robust applications without worrying about managing complex state. Additionally, `CoreCraft` provides built-in persistence options, allowing you to easily save and load your application's state to a database or file.\n\n## Main Features\n\nThe `CoreCraft` provides a wealth of features, including:\n\n1. **Automatic code generation with Roslyn Source Generators**: `CoreCraft` leverages Roslyn Source Generators by automatically generating all necessary entity classes, changes tracking and persistence based on your schema. This automated process eliminates the necessity of manual coding, saving you time and effort.\n\n1. **Change Tracking and Undo/Redo support**: `CoreCraft` implements change tracking mechanisms, allowing you to monitor the application's state modifications. By tracking changes at a granular level, `CoreCraft` notifies you of specific modifications, enabling you to respond effectively. It provides built-in support for managing and reverting changes, allowing users to undo actions and redo them as needed.\n\n1. **Persistence Options**: `CoreCraft` automatically generates the necessary code to handle persistence (no need to write SQL yourself). It supports saving and loading the application's state to a **SQLite** database and **JSON** files.\n\n1. **Reactive Extensions (Rx.NET) Integration**: `CoreCraft` incorporates Reactive Extensions ([Rx.NET](https://github.com/dotnet/reactive)) to provide a flexible subscription mechanism. It utilizes the `IObservable` and `IObserver` interfaces, allowing you to leverage the power of Rx.NET for event-driven programming and reactive data processing.\n\n## Benefits\n\n- Simplify application state management\n- Reduce development time and effort\n- Improve data integrity and consistency\n\n## NuGet Packages\n\nCoreCraft is distributed as NuGet packages.\n\n| Package                  |                                                                            Status                                                                             |\n| :----------------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: |\n| CoreCraft                |                [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/CoreCraft?color=blue)](https://www.nuget.org/packages/CoreCraft)                |\n| CoreCraft.Generators     |     [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/CoreCraft.Generators?color=blue)](https://www.nuget.org/packages/CoreCraft.Generators)     |\n| CoreCraft.Storage.SQLite | [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/CoreCraft.Storage.SQLite?color=blue)](https://www.nuget.org/packages/CoreCraft.Storage.SQLite) |\n| CoreCraft.Storage.Json   |   [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/CoreCraft.Storage.Json?color=blue)](https://www.nuget.org/packages/CoreCraft.Storage.Json)   |\n\n## Getting Started\n\nTo start using CoreCraft, follow these steps:\n\n1. **Install CoreCraft and CoreCraft.Generators packages**: Run the following command in your terminal or command prompt:\n\n```\ndotnet add package CoreCraft\ndotnet add package CoreCraft.Generators\n```\n\n2. **Create a schema file with extension `.model.json`**: Create a new JSON file with the name `your_schema.model.json` (replace `your_schema` with your desired schema name). This file will define the structure of your application state.\n\n```json\n{\n  \"shards\": [\n    {\n      \"name\": \"ToDo\",\n      \"entities\": [\n        {\n          \"name\": \"ToDoItem\",\n          \"properties\": [\n            { \"name\": \"Name\", \"type\": \"string\", \"defaultValue\": \"string.Empty\" }\n          ]\n        }\n      ],\n      \"collections\": [{ \"name\": \"Items\", \"entityType\": \"ToDoItem\" }],\n      \"relations\": []\n    }\n  ]\n}\n```\n\n3. **Add the schema file to the csproj project file as `AdditionalFiles`**: Open your `.csproj` file and add the following lines:\n\n```xml\n\u003cItemGroup\u003e\n  \u003cAdditionalFiles Include=\"path\\to\\your_schema.model.json\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\nReplace `path\\to\\your_schema.model.json` with the actual path to your schema file.\n\n4. **Create an instance of the `DomainModel` class and register all generated `ModelShards`**: In your code, create an instance of the `DomainModel` class and register all generated model shards:\n\n```cs\nvar model = new DomainModel([new ToDoModelShard()]);\n```\n\n### Example\n\nHere's a example code snippet that demonstrates how to use the `CoreCraft`:\n\n```cs\n// Create an instance of the domain model (application state)\nvar model = new DomainModel([new ToDoModelShard()]);\n\n// Subscribe to Items collection change events\nusing var subscription = model.For\u003cIToDoChangesFrame\u003e()\n    .With(x =\u003e x.Items)\n    .Subscribe(OnItemChanged);\n\n// Observe changes\nvoid OnItemChanged(Change\u003cICollectionChangeSet\u003cToDoItem, ToDoItemProperties\u003e\u003e changes)\n{\n    foreach (var c in changes.Hunk)\n    {\n        Console.WriteLine($\"Entity [{c.Entity}] has been {c.Action}ed.\");\n        Console.WriteLine($\"   Old data: {c.OldData}\");\n        Console.WriteLine($\"   New data: {c.NewData}\");\n    }\n}\n\n// Adds new item to the collection\nawait model.Run\u003cIMutableToDoModelShard\u003e(\n    (shard, _) =\u003e shard.Items.Add(new () { Name = \"test\" }));\n\n// Saves model to the SQLite database\nvar storage = new SqliteStorage(\"my_data.db\", []);\nawait model.Save(storage);\n```\n\nPlease refer to the [documentation](https://github.com/AlexNav73/CoreCraft/wiki/Getting-Started) for comprehensive information on using the `CoreCraft` toolkit and its features.\n\n## License\n\n[MIT](LICENSE).\n","funding_links":[],"categories":["Contributors Welcome for those"],"sub_categories":["1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexNav73%2FCoreCraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAlexNav73%2FCoreCraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAlexNav73%2FCoreCraft/lists"}