{"id":18332016,"url":"https://github.com/mrousavy/morph","last_synced_at":"2025-04-09T18:30:04.221Z","repository":{"id":78946243,"uuid":"100975941","full_name":"mrousavy/Morph","owner":"mrousavy","description":"🛠 A fast .NET Standard Class Library for parsing results from an SQL query to .NET objects to eliminate risky column-index hardcoding","archived":false,"fork":false,"pushed_at":"2020-06-18T08:40:45.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T11:16:50.666Z","etag":null,"topics":["csharp","dotnet","library","parser","sql"],"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/mrousavy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"mrousavy","ko_fi":"mrousavy","custom":["https://paypal.me/mrousavy"]}},"created_at":"2017-08-21T17:21:43.000Z","updated_at":"2024-07-15T07:41:52.000Z","dependencies_parsed_at":"2023-02-24T23:00:14.471Z","dependency_job_id":null,"html_url":"https://github.com/mrousavy/Morph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2FMorph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2FMorph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2FMorph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2FMorph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrousavy","download_url":"https://codeload.github.com/mrousavy/Morph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248087468,"owners_count":21045527,"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":["csharp","dotnet","library","parser","sql"],"created_at":"2024-11-05T19:36:56.950Z","updated_at":"2025-04-09T18:30:04.188Z","avatar_url":"https://github.com/mrousavy.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg align=\"right\" src=\"https://raw.githubusercontent.com/mrousavy/Morph/master/Images/emoji_hammer_and_wrench.png\" height=\"120\" /\u003e\n  \u003ch1 align=\"left\"\u003eMorph\u003c/h3\u003e\n  \u003cp align=\"left\"\u003eA fast .NET Standard Class Library for parsing results from an SQL query to .NET objects\u003c/p\u003e\n  \u003cp align=\"left\"\u003e\n    \u003ca href=\"http://nuget.org/packages/Morph/\"\u003e\u003cimg src=\"https://img.shields.io/badge/nuget-Morph-blue.svg\" alt=\"Morph on NuGet\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://ci.appveyor.com/project/mrousavy/morph\"\u003e\u003cimg src=\"https://ci.appveyor.com/api/projects/status/k6dd0rtskfjxrw4o?svg=true\" alt=\"Morph build status\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003ca href='https://ko-fi.com/F1F8CLXG' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Why?\n\nThe default **hardcode-index-way** of creating objects from a _Data Reader_ can be really messy for _large objects_ with _many columns_.\n\n**Morph** aims to _simplify_ this process by **only needing a single line of code** to parse Data Reader results, and by making code bases **easily extensible** with the `ColumnName` Attributes.\n\nA _small_ example:\n```cs\nif (await reader.ReadAsync()) {\n  var person = new Person() {\n    FirstName = reader[\"PERSON_FIRST_NAME\"],\n    LastName = reader[\"PERSON_LAST_NAME\"],\n    Address = reader[\"PERSON_ADDRESS\"]\n  };\n}\n```\n\nWith **Morph**'s extension Method:\n```cs\nvar person = await reader.Parse\u003cPerson\u003e();\n```\n_(Requires a `using` directive to the `mrousavy.Morph` namespace)_\n\nKeep in mind to **mark the Members** you want to parse with the `ColumnName` Attribute in `Person`:\n```cs\npublic class Person {\n  [ColumnName(\"PERSON_FIRST_NAME\")]\n  public string FirstName { get; set; }   // Will be set to \"PERSON_FIRST_NAME\" (ColumnName parameter) from the DataBase\n\n  [ColumnName]\n  public string LastName { get; set; }    // Will be set to \"LastName\" (Member name) from the Database\n\n  public string Address { get; set; }     // Will be ignored and not initialized by the Parser\n}\n```\n\n## Build\nBuild with [.NET Core](https://www.microsoft.com/net/download/core) 2.0 or higher\n","funding_links":["https://github.com/sponsors/mrousavy","https://ko-fi.com/mrousavy","https://paypal.me/mrousavy","https://ko-fi.com/F1F8CLXG'"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrousavy%2Fmorph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrousavy%2Fmorph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrousavy%2Fmorph/lists"}