{"id":34725947,"url":"https://github.com/laskarzhevsky/pocodataset","last_synced_at":"2026-02-28T16:05:19.517Z","repository":{"id":323558445,"uuid":"1093747814","full_name":"Laskarzhevsky/PocoDataSet","owner":"Laskarzhevsky","description":"Lightweight POCO-based in-memory DataSet / DataTable / DataRow library for .NET","archived":false,"fork":false,"pushed_at":"2026-02-21T00:00:52.000Z","size":1227,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-21T01:49:13.218Z","etag":null,"topics":["dataset","dotnet","inmemory","library","poco"],"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/Laskarzhevsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-10T19:35:39.000Z","updated_at":"2026-02-20T23:53:30.000Z","dependencies_parsed_at":"2026-01-04T06:05:32.223Z","dependency_job_id":null,"html_url":"https://github.com/Laskarzhevsky/PocoDataSet","commit_stats":null,"previous_names":["laskarzhevsky/pocodataset"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/Laskarzhevsky/PocoDataSet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laskarzhevsky%2FPocoDataSet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laskarzhevsky%2FPocoDataSet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laskarzhevsky%2FPocoDataSet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laskarzhevsky%2FPocoDataSet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Laskarzhevsky","download_url":"https://codeload.github.com/Laskarzhevsky/PocoDataSet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laskarzhevsky%2FPocoDataSet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29671513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T00:11:43.526Z","status":"online","status_checked_at":"2026-02-21T02:00:07.432Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dataset","dotnet","inmemory","library","poco"],"created_at":"2025-12-25T02:27:19.755Z","updated_at":"2026-02-28T16:05:19.504Z","avatar_url":"https://github.com/Laskarzhevsky.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# PocoDataSet\n\nThe POCO DataSet documentation is published in the \"POCO DataSet\" section of **businessprocessprogramming.net** website.\n\n**PocoDataSet** is a lightweight, in-memory `DataSet` / `DataTable` / `DataRow` model built around simple POCOs and interfaces.\n\nIt is designed to be:\n\n- **UI-friendly** – works well with Blazor, WPF, WinUI, etc.\n- **POCO-based** – data is represented as plain C# objects, not tied to any specific framework.\n- **Extensible** – core contracts live in `PocoDataSet.IData`, with implementations and helpers in separate projects.\n\n---\n\n## Project structure\n\nThe solution contains the following projects:\n\n- **PocoDataSet.IData**  \n  Interfaces and contracts only:\n  - `IDataSet`, `IDataTable`, `IDataRow`\n  - `IColumnMetadata`, `IDataRelation`, `IForeignKeyData`\n  - `IDataSetValidator`, `IMergeOptions`\n  - `IValueConverter` (for pluggable value conversion)\n\n  Interfaces and contracts for the merge infrastructure:\n  - `IDataSetMergeEngine` – orchestrates DataSet / DataTable / DataRow merge\n  - `IDataSetMergeConfiguration` – provides merge policies and handlers\n  - `ITableMergeHandler` – table-level merge behavior\n  - `IRowMergeHandler` – row-level merge behavior\n\n- **PocoDataSet.Data**  \n  Concrete implementations of the interfaces:\n  - `DataSet` – holds a dictionary of named tables and relations\n  - `DataTable` – holds columns and rows\n  - `DataRow` – a dictionary-backed row with helper methods and state (`RowState`, `Selected`)\n  - `ColumnMetadata`, `DataRelation`, `ForeignKeyData`\n\n- **PocoDataSet.Extensions**  \n  Convenience extension methods and helpers:\n  - `DataSetExtensions`\n    - `AddTable`, `AddNewTable`, `AddRow`, `RemoveRow`, `RemoveTable`\n    - `GetTable`, `GetRequiredTable`, `TryGetTable`, `GetFieldValue\u003cT\u003e`\n    - `MergeWith` and related merge helpers\n  - `DataTableExtensions`\n    - `AddColumn`, `AddColumns`\n    - `AddColumnsFromInterface` (build schema from a .NET interface)\n  - `DataRowExtensions`\n    - `CreateRowFromColumns`, `CreateRowFromColumnsWithDefaultValues`\n    - `GetDataFieldValue\u003cT\u003e` (with friendly conversion)\n    - `CopyFromPoco`, `ToPoco`, `MergeWith`\n  - `DataSetFactory`\n    - `CreateDataSet()` – simple factory for `IDataSet`\n  - Internal helpers (data type names, default value helpers, type info, etc.)\n\n  Default implementation of the merge infrastructure:\n  - `DataSetMergeEngine` – handler-based merge engine\n  - `DataSetMergeConfiguration` – default configuration and wiring\n  - `DefaultTableMergeHandler` – primary-key based table merge\n  - `DefaultRowMergeHandler` – value-level row merge\n  - `DataTypeDefaultValueProvider` – default metadata-to-value mapping\n\n\n- **PocoDataSet.IObservableData**  \n  Interfaces and contracts for the observable layer (UI reactivity support):\n  - `IObservableDataSet`, `IObservableDataTable`, `IObservableDataRow`, `IObservableDataView`\n  - Event args such as `RowsChangedEventArgs` and `DataFieldValueChangedEventArgs`\n\n  This project contains **contracts only** and has no runtime dependencies on UI frameworks.\n\n- **PocoDataSet.ObservableData**  \n  Concrete implementations of the observable contracts:\n  - `ObservableDataSet` – wraps an `IDataSet` and bubbles table / row events\n  - `ObservableDataTable` – wraps an `IDataTable` and tracks observable rows\n  - `ObservableDataRow` – wraps an `IDataRow` and raises `DataFieldValueChanged`\n  - `ObservableDataView` – per-control view over a table (filter/sort) with deterministic disposal\n\n  Notes:\n  - `ObservableDataSet` **owns** created views and disposes them when the source table is removed.\n  - `ObservableDataView` subscribes to table events and maintains its own row list; it unsubscribes on dispose.\n\n- **PocoDataSet.ObservableExtensions**  \n  Convenience extension methods to bridge POCO DataSet and the observable layer:\n  - Create observable wrappers from `IDataSet` / `IDataTable`\n  - Helpers for common UI scenarios (one view per control instance, etc.)\n\n- **PocoDataSet.Serializer**  \n  JSON serialization helpers using `System.Text.Json`:\n  - `DataSetSerializer.FromJsonString(string? json) : IDataSet?`\n  - `DataSetSerializer.ToJsonString(IDataSet dataSet) : string`\n\n - **PocoDataSet.SqlServerDataAdapter**  \nThe `PocoDataSet.SqlServerDataAdapter` project provides a lightweight SQL Server adapter that fills `PocoDataSet` in-memory `IDataSet`/`IDataTable` structures from T-SQL queries. It is intended as an example/utility that demonstrates reading schema, primary key and foreign key information and populating `PocoDataSet.Data` model objects.\n\n## Purpose\n- Execute queries against SQL Server and populate `IDataSet`/`IDataTable`/`IDataRow`.\n- Preserve table/column metadata (column names, data types, max length, primary keys, foreign keys, nullability).\n- Provide an async-friendly `FillAsync` API that accepts parameter dictionaries to avoid inline concatenation and reduce risk of SQL injection.\n\n## Key types\n- `PocoDataSet.SqlServerDataAdapter.SqlDataAdapter` — main adapter class used to execute queries and return an `IDataSet`.\n- `PocoDataSet.SqlServerDataAdapter.DataTableCreator` — internal helper used by the adapter to create `DataTable` instances with columns, primary keys and rows.\n- `PocoDataSet.SqlServerDataAdapter.ForeignKeyData` — holds foreign key mapping information used when building `ColumnMetadata`.\n\n## Notable behaviors\n- `DataTableCreator` reads column schema from `SqlDataReader.GetSchemaTable()` and populates `ColumnMetadata` fields such as `ColumnName`, `DataType`, `MaxLength`, and (when implemented) `IsNullable`. The project also supports loading primary key information and populating `DataTable.PrimaryKey`.\n- The adapter supports a parameter dictionary passed into `FillAsync`, e.g. `IDictionary\u003cstring, object?\u003e` to map command parameters.\n\n## Integration notes\n- The adapter uses `Microsoft.Data.SqlClient`. Ensure your application has the package referenced.\n- `FillAsync` supports parameter dictionaries; keys should match the parameter names used in the SQL (including the `@` if you use it in your code).\n- `DataTableCreator` exposes an event (`LoadDataTableKeysInformationRequest`) so callers can supply primary key and foreign-key lookup data before columns/rows are finalized. This allows key population logic to run before rows are added.\n\n## Recommended improvements (already implemented or easy to add)\n- Populate `ColumnMetadata.IsNullable` from `GetSchemaTable()` (`AllowDBNull` / `IsNullable`) when available.\n- Populate `DataTable.PrimaryKey` from key discovery (the adapter already provides hooks to fetch primary key information — call these before finalizing the `DataTable`).\n- Ensure the adapter infers nullability conservatively when the provider schema does not include it (for example, treat CLR non-nullable value types as non-nullable).\n\n## Where to find it in the solution\n- Project folder: `PocoDataSet.SqlServerDataAdapter`\n- Key files:\n  - `SqlDataAdapter.cs` — public adapter API\n  - `DataTableCreator/*.cs` — schema / row building helpers\n  - `ForeignKeyData.cs` — FK metadata model\n\n---\n\n- **PocoDataSet.EfCoreBridge**  \n  Optional bridge between Entity Framework Core and PocoDataSet.\n  It provides convenience helpers to materialize EF Core queries (sync/async) and project results into a PocoDataSet `IDataTable`.\n\n  ## Purpose\n  - Convert `IQueryable\u003cTEntity\u003e` results into `IDataTable` using explicit schema (`List\u003cIColumnMetadata\u003e`).\n  - Support both synchronous and asynchronous query execution (`ToDataTable(...)` / `ToDataTableAsync(...)`).\n  - Keep UI layers dataset-driven while allowing EF Core as the persistence/query model.\n\n  ## Key types / extension methods\n  - `QueryableExtensions.ToDataTable(...)`\n  - `QueryableExtensions.ToDataTableAsync(...)`\n\n  ## Notable behaviors\n  - Schema is provided explicitly via `listOfColumnMetadata` to keep deterministic columns and avoid accidentally including navigation/complex properties.\n  - Internally, the bridge composes existing PocoDataSet extensions:\n    - `IDataSet.PocoListToDataTable\u003cT\u003e(...)`\n    - `IDataTable.CopyFromPocoList\u003cT\u003e(...)`\n    - `IDataRow.CopyFromPoco(...)` / `IDataRow.CopyToPoco(...)`\n    - `IDataRow.ToPoco\u003cT\u003e()`\n\n  ## Where to find it in the solution\n  - Project folder: `PocoDataSet.EfCoreBridge`\n\n## Getting started\n\n### 1. Add the projects to your solution\n\nIf you cloned this repo standalone:\n\n- Open `PocoDataSetSolution.sln` in Visual Studio or `dotnet` CLI.\n- Or reference the projects from your own solution:\n\n\u003cItemGroup\u003e\n  \u003cProjectReference Include=\"..\\PocoDataSet.IData\\PocoDataSet.IData.csproj\" /\u003e\n  \u003cProjectReference Include=\"..\\PocoDataSet.Data\\PocoDataSet.Data.csproj\" /\u003e\n  \u003cProjectReference Include=\"..\\PocoDataSet.Extensions\\PocoDataSet.Extensions.csproj\" /\u003e\n  \u003cProjectReference Include=\"..\\PocoDataSet.IObservableData\\PocoDataSet.IObservableData.csproj\" /\u003e\n\u003cProjectReference Include=\"..\\PocoDataSet.ObservableData\\PocoDataSet.ObservableData.csproj\" /\u003e\n\u003cProjectReference Include=\"..\\PocoDataSet.ObservableExtensions\\PocoDataSet.ObservableExtensions.csproj\" /\u003e\n\u003cProjectReference Include=\"..\\PocoDataSet.Serializer\\PocoDataSet.Serializer.csproj\" /\u003e\n  \u003cProjectReference Include=\"..\\PocoDataSet.SqlServerDataAdapter\\PocoDataSet.SqlServerDataAdapter.csproj\" /\u003e\n\u003c/ItemGroup\u003e\n\n\n## Observable layer (UI reactivity)\n\nIf you are building a UI (Blazor/WPF/WinUI/etc.) and want event-driven updates, use the observable layer:\n\n- **Contracts:** `PocoDataSet.IObservableData`\n- **Implementations:** `PocoDataSet.ObservableData`\n- **Helpers:** `PocoDataSet.ObservableExtensions`\n\nRecommended usage pattern (one view per control instance):\n- Call `ObservableDataSet.GetObservableDataView(tableName, filter, caseSensitive, sort, requestorName)`\n- Ensure `requestorName` is **unique per control instance** (the observable layer enforces this)\n- Dispose the view (or remove the table) to unsubscribe event handlers deterministically\n\n## License\n\nThis project is licensed under the MIT License.  \nSee the [LICENSE](LICENSE) file for details.\n\n## Installation\n\nThe easiest way to get started is to install the meta-package:\n\ndotnet add package PocoDataSet\n\nThis will bring in:\nPocoDataSet.IData\nPocoDataSet.Data\nPocoDataSet.Extensions\nPocoDataSet.Serializer\nPocoDataSet.SqlServerDataAdapter\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaskarzhevsky%2Fpocodataset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaskarzhevsky%2Fpocodataset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaskarzhevsky%2Fpocodataset/lists"}