{"id":13629407,"url":"https://github.com/SoftStoneDevelop/Gedaq","last_synced_at":"2025-04-17T09:33:41.120Z","repository":{"id":65761965,"uuid":"534887627","full_name":"SoftStoneDevelop/Gedaq","owner":"SoftStoneDevelop","description":"ORM Gedaq is generator for obtaining and mapping data from the database.","archived":false,"fork":false,"pushed_at":"2024-09-26T22:51:10.000Z","size":2018,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T20:45:33.504Z","etag":null,"topics":["ado-net","code-generation","csharp","dbconnection","dotnet","mapping","micro-orm","mysql","mysqlconnector","netcore6","npgsql","oracle-manageddataacess-core","orm","postgres","roslyn","roslyn-generator","sql","sqlclient"],"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/SoftStoneDevelop.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}},"created_at":"2022-09-10T04:13:08.000Z","updated_at":"2024-09-26T22:49:48.000Z","dependencies_parsed_at":"2023-10-01T19:08:55.785Z","dependency_job_id":"6b6fb36b-c03f-424b-b3e1-7be43eb13da4","html_url":"https://github.com/SoftStoneDevelop/Gedaq","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftStoneDevelop%2FGedaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftStoneDevelop%2FGedaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftStoneDevelop%2FGedaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftStoneDevelop%2FGedaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftStoneDevelop","download_url":"https://codeload.github.com/SoftStoneDevelop/Gedaq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249331668,"owners_count":21252627,"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":["ado-net","code-generation","csharp","dbconnection","dotnet","mapping","micro-orm","mysql","mysqlconnector","netcore6","npgsql","oracle-manageddataacess-core","orm","postgres","roslyn","roslyn-generator","sql","sqlclient"],"created_at":"2024-08-01T22:01:09.649Z","updated_at":"2025-04-17T09:33:40.617Z","avatar_url":"https://github.com/SoftStoneDevelop.png","language":"C#","readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca\u003eGedaq\u003c/a\u003e\n\u003c/h1\u003e\n\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://discord.gg/xsR5EYU4ZM\"\u003e\u003cimg height=\"30px\" src=\"https://img.shields.io/badge/Discord-7289DA?style=for-the-badge\u0026logo=discord\u0026logoColor=white\"\u003e\u003cimg\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003e\n\n  [![Nuget](https://img.shields.io/nuget/v/Gedaq?logo=Gedaq)](https://www.nuget.org/packages/Gedaq/)\n  [![Downloads](https://img.shields.io/nuget/dt/Gedaq.svg)](https://www.nuget.org/packages/Gedaq/)\n  [![Stars](https://img.shields.io/github/stars/SoftStoneDevelop/Gedaq?color=brightgreen)](https://github.com/SoftStoneDevelop/Gedaq/stargazers)\n  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n\u003c/h3\u003e\n\nGenerator for obtaining and mapping data from the database.\nGenerates methods (synchronous and/or asynchronous):\n- Creating a Command for a query\n- Method of setting parameters in a Command\n- Command execution, with data mapping\n\n- Creating a QueryBatch Command\n- Setting parameters in a QueryBatch Command\n- Get data from a batch Command\n- Receiving data from a batch of queries, with data mapping\n\n- Getting data based on a query, with data mapping\n\nThere are versions for all of these methods (if possible):\n- Query\n- NonQuery\n- ЕecuteScalar (return type is determined automatically at the generation stage)\n\u003cbr\u003e\nIt also generates methods specific to each provider, such as BinaryImport and BinaryExport in PostgreSQL.\n\nSupported databases(see examples and documentation in the relevant DB package):\u003cbr\u003e\n- [Npgsql](https://github.com/SoftStoneDevelop/Gedaq.Npgsql)\n- [DbConnection](https://github.com/SoftStoneDevelop/Gedaq.DbConnection)\n- [SqlClient](https://github.com/SoftStoneDevelop/Gedaq.SqlClient)\n- [MySqlConnector](https://github.com/SoftStoneDevelop/Gedaq.MySqlConnector)\n- [Oracle.ManagedDataAccess.Core](https://github.com/SoftStoneDevelop/Gedaq/issues/6)\n\u003cbr\u003e\n\nUsage:\n\nFor example, we have a Person class:\n```C#\n\npublic class Person\n{\n    public int Id { get; set; }\n\n    public string FirstName { get; set; }\n\n    public string MiddleName { get; set; }\n\n    public string LastName { get; set; }\n    \n    public Identification Identification { get; set; }\n}\n\npublic class Identification\n{\n    public int Id { get; set; }\n    public string TypeName { get; set; }\n}\n\n```\nWe just mark anywhere in the code with a special attribute (class, structure, method) that tells the analyzer to generate the code.\nLet's mark the Person class itself with an attribute:\n\n```C#\n\n[Query(\n            @\"\nSELECT \n    p.id,\n    p.firstname,\n~StartInner::Identification:id~\n    i.id,\n    i.typename,\n~EndInner::Identification~\n    p.middlename,\n    p.lastname\nFROM person p\nLEFT JOIN identification i ON i.id = p.identification_id\nWHERE p.id \u003e $1\n\",\n        \"GetAllPerson\",\n        typeof(Person),\n        MethodType.Sync | MethodType.Async\n        ),\n        Parametr(parametrType: typeof(int), position: 1)\n        ]\npublic class Person\n//...\n\n```\n\nNow in the code we can call the ready method:\n```C#\n\nvar persons = \n        connection\n        .GetAllPerson(49999)\n        .ToList();\n        \nvar personsAsync = \n        await connection\n        .GetAllPersonAsync(49999)\n        .ToListAsync();\n\n```\n\n[Comparison](https://github.com/SoftStoneDevelop/Gedaq.Npgsql/blob/main/Src/NpgsqlBenchmark/Benchmarks/CompareDapper.cs) with [Dapper](https://github.com/DapperLib/Dapper) and [DapperAOT](https://github.com/DapperLib/DapperAOT) of getting 50000 Person in a loop(Size is number of loop iterations) from the database:\n\n## .NET 7 Benchmark:\n|       Method | Size |       Mean | Ratio | Allocated | Alloc Ratio |\n|------------- |----- |-----------:|------:|----------:|------------:|\n| **Gedaq.Npgsql** |   **10** |   **445.5 ms** |  **1.00** | **132.09 MB** |        **1.00** |\n|       Dapper |   10 |   749.2 ms |  1.68 | 150.41 MB |        1.14 |\n|    DapperAOT |   10 |   777.5 ms |  1.75 |  150.4 MB |        1.14 |\n|              |      |            |       |           |             |\n| **Gedaq.Npgsql** |   **20** |   **901.9 ms** |  **1.00** | **264.17 MB** |        **1.00** |\n|       Dapper |   20 | 1,510.0 ms |  1.68 | 300.81 MB |        1.14 |\n|    DapperAOT |   20 | 1,505.3 ms |  1.67 | 300.81 MB |        1.14 |\n|              |      |            |       |           |             |\n| **Gedaq.Npgsql** |   **30** | **1,366.2 ms** |  **1.00** | **396.28 MB** |        **1.00** |\n|       Dapper |   30 | 2,276.7 ms |  1.67 | 451.22 MB |        1.14 |\n|    DapperAOT |   30 | 2,279.6 ms |  1.67 | 451.22 MB |        1.14 |\n\nBut with Gedaq, we can prepare the command in advance.\n```C#\n\nvar personsCmd = connection.CreateGetAllPersonCommand(prepare: true);\npersonsCmd.SetGetAllPersonParametrs(49999);\nvar persons = personsCmd.ExecuteGetAllPersonCommand().ToList();\n\n//or\n\nvar personsCmd = await connection.CreateGetAllPersonCommandAsync(prepare: true);\npersonsCmd.SetGetAllPersonParametrs(49999);\nvar persons = await personsCmd.ExecuteGetAllPersonCommandAsync().ToListAsync();\n\n\n```\n","funding_links":[],"categories":["Content"],"sub_categories":["29. [Gedaq](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Gedaq) , in the [Database](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#database) category"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoftStoneDevelop%2FGedaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSoftStoneDevelop%2FGedaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoftStoneDevelop%2FGedaq/lists"}