{"id":15039289,"url":"https://github.com/dimitrietataru/catnip-domain","last_synced_at":"2026-01-28T12:34:43.600Z","repository":{"id":215619423,"uuid":"739387112","full_name":"dimitrietataru/catnip-domain","owner":"dimitrietataru","description":"CatNip - Domain Abstractions","archived":false,"fork":false,"pushed_at":"2024-11-26T00:10:56.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"ace","last_synced_at":"2025-04-10T00:05:25.371Z","etag":null,"topics":["abstractions","clean-architecture","csharp","domain","dot-net"],"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/dimitrietataru.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":"2024-01-05T12:49:43.000Z","updated_at":"2024-11-26T00:11:00.000Z","dependencies_parsed_at":"2024-02-07T11:27:36.830Z","dependency_job_id":"25f1ebcf-7c0c-4ef5-9f7b-7e5aa60859c5","html_url":"https://github.com/dimitrietataru/catnip-domain","commit_stats":null,"previous_names":["dimitrietataru/catnip-domain"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/dimitrietataru/catnip-domain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrietataru%2Fcatnip-domain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrietataru%2Fcatnip-domain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrietataru%2Fcatnip-domain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrietataru%2Fcatnip-domain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimitrietataru","download_url":"https://codeload.github.com/dimitrietataru/catnip-domain/tar.gz/refs/heads/ace","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrietataru%2Fcatnip-domain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["abstractions","clean-architecture","csharp","domain","dot-net"],"created_at":"2024-09-24T20:42:20.610Z","updated_at":"2026-01-28T12:34:43.574Z","avatar_url":"https://github.com/dimitrietataru.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Clean Architecture Template - Never-ending Improvement Process\n\n[![build](https://github.com/dimitrietataru/catnip-domain/actions/workflows/build.yml/badge.svg)](https://github.com/dimitrietataru/catnip-domain/actions/workflows/build.yml)\n[![release](https://github.com/dimitrietataru/catnip-domain/actions/workflows/release.yml/badge.svg)](https://github.com/dimitrietataru/catnip-domain/actions/workflows/release.yml)\n[![NuGet](https://img.shields.io/nuget/v/CatNip.Domain)](https://www.nuget.org/packages/CatNip.Domain)\n\n# Domain Abstractions\n\n## IModel\n\nIntroducing the **IModel** type.\n\n``` csharp\ninterface IModel\n{\n}\n```\n\nAt *Service* and *Repository* layer, the following actions can be performed:\n  * Queries\n    * GetAll()\n    * Count()\n  * Commands\n    * Create(TModel)\n    * Update(TModel)\n    * Delete(TModel)\n\n\u003cdetails\u003e\n  \u003csummary\u003eIModel abstractions\u003c/summary\u003e\n\n### Definition\n``` csharp\ninterface IModel\n{\n}\n\nabstract class Model : IEquatable\u003cModel\u003e, IModel\n{\n    public override bool Equals(object? obj) { .. }\n    public override int GetHashCode() { .. }\n\n    public abstract bool Equals(Model? other);\n    protected abstract int DetermineHashCode();\n}\n```\n\n### Service\n``` csharp\ninterface IQueryService\u003cTModel\u003e\n    where TModel : IModel\n{\n    Task\u003cIEnumerable\u003cTModel\u003e\u003e GetAllAsync(CancellationToken cancellation);\n    Task\u003cint\u003e CountAsync(CancellationToken cancellation);\n}\n\ninterface ICommandService\u003cTModel\u003e\n    where TModel : IModel\n{\n    Task CreateAsync(TModel model, CancellationToken cancellation);\n    Task UpdateAsync(TModel model, CancellationToken cancellation);\n    Task DeleteAsync(TModel model, CancellationToken cancellation);\n}\n\ninterface ICrudService\u003cTModel\u003e : IQueryService\u003cTModel\u003e, ICommandService\u003cTModel\u003e\n    where TModel : IModel\n{\n}\n```\n\n### Repository\n``` csharp\ninterface IQueryRepository\u003cTModel\u003e\n    where TModel : IModel\n{\n    Task\u003cIEnumerable\u003cTModel\u003e\u003e GetAllAsync(CancellationToken cancellation);\n    Task\u003cint\u003e CountAsync(CancellationToken cancellation);\n}\n\ninterface ICommandRepository\u003cTModel\u003e\n    where TModel : IModel\n{\n    Task CreateAsync(TModel model, CancellationToken cancellation);\n    Task UpdateAsync(TModel model, CancellationToken cancellation);\n    Task DeleteAsync(TModel model, CancellationToken cancellation);\n}\n\ninterface ICrudRepository\u003cTModel\u003e : IQueryRepository\u003cTModel\u003e, ICommandRepository\u003cTModel\u003e\n    where TModel : IModel\n{\n}\n```\n\n\u003c/details\u003e\n\n## IModel\\\u003cTId\\\u003e\n\nIntroducing the **IModel\\\u003cTId\\\u003e** type\n\n``` csharp\ninterface IModel\u003cTId\u003e : IModel\n    where TId : IEquatable\u003cTId\u003e\n{\n    TId Id { get; }\n}\n```\n\nAt *Service* and *Repository* layer, the previous actions are extended and the following extra actions can be performed:\n  * Queries\n    * GetById(TId)\n    * Exists(TId)\n  * Commands\n    * Create(TModel)\n    * Update(TId, TModel)\n    * Delete(TId)\n\n\u003cdetails\u003e\n  \u003csummary\u003eIModel\u003c TId \u003e abstractions\u003c/summary\u003e\n\n### Definition\n``` csharp\ninterface IModel\u003cTId\u003e : IModel\n    where TId : IEquatable\u003cTId\u003e\n{\n    TId Id { get; }\n}\n\nabstract class Model\u003cTId\u003e : Model, IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n    public virtual TId Id { get; set; }\n\n    public override bool Equals(Model? other) { .. }\n    protected override int DetermineHashCode() { .. }\n}\n```\n\n### Service\n``` csharp\ninterface IQueryService\u003cTModel, TId\u003e : IQueryService\u003cTModel\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n    Task\u003cTModel\u003e GetByIdAsync(TId id, CancellationToken cancellation);\n    Task\u003cbool\u003e ExistsAsync(TId id, CancellationToken cancellation);\n}\n\ninterface ICommandService\u003cTModel, TId\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n    Task\u003cTModel\u003e CreateAsync(TModel model, CancellationToken cancellation);\n    Task UpdateAsync(TId id, TModel model, CancellationToken cancellation);\n    Task DeleteAsync(TId id, CancellationToken cancellation);\n}\n\ninterface ICrudService\u003cTModel, TId\u003e : IQueryService\u003cTModel, TId\u003e, ICommandService\u003cTModel, TId\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n}\n```\n\n### Repository\n``` csharp\ninterface IQueryRepository\u003cTModel, TId\u003e : IQueryRepository\u003cTModel\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n    Task\u003cTModel\u003e GetByIdAsync(TId id, CancellationToken cancellation);\n    Task\u003cbool\u003e ExistsAsync(TId id, CancellationToken cancellation);\n}\n\ninterface ICommandRepository\u003cTModel, TId\u003e : ICommandRepository\u003cTModel\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n    Task\u003cTModel\u003e CreateAsync(TModel model, CancellationToken cancellation);\n    Task UpdateAsync(TId id, TModel model, CancellationToken cancellation);\n    Task DeleteAsync(TId id, CancellationToken cancellation);\n}\n\ninterface ICrudRepository\u003cTModel, TId\u003e : IQueryRepository\u003cTModel, TId\u003e, ICommandRepository\u003cTModel, TId\u003e\n    where TModel : IModel\u003cTId\u003e\n    where TId : IEquatable\u003cTId\u003e\n{\n}\n```\n\n\u003c/details\u003e\n\n### Related projects\n* [catnip-application](https://github.com/dimitrietataru/catnip-application)\n* [catnip-infrastructure](https://github.com/dimitrietataru/catnip-infrastructure)\n* [catnip-presentation](https://github.com/dimitrietataru/catnip-presentation)\n* [csharp-coding-standards](https://github.com/dimitrietataru/csharp-coding-standards)\n\n### License\nCatNip.Domain is Copyright © 2023 [Dimitrie Tataru](https://github.com/dimitrietataru) and other contributors under the [MIT license](https://github.com/dimitrietataru/catnip-domain/blob/ace/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitrietataru%2Fcatnip-domain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimitrietataru%2Fcatnip-domain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitrietataru%2Fcatnip-domain/lists"}