{"id":23274916,"url":"https://github.com/alveflo/crudmaker","last_synced_at":"2026-03-08T08:33:57.554Z","repository":{"id":73376456,"uuid":"291647236","full_name":"alveflo/CrudMaker","owner":"alveflo","description":"Generate your crud endpoints automatically :rocket: More popular than a pair of socks!","archived":false,"fork":false,"pushed_at":"2021-11-26T09:07:14.000Z","size":54,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T16:48:16.989Z","etag":null,"topics":["aspnetcore","automapper","dotnet-core","efcore","fluentvalidation","odata"],"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/alveflo.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":"2020-08-31T07:36:07.000Z","updated_at":"2025-01-28T07:11:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a51ebf3-accf-4f41-b072-e48167b3c088","html_url":"https://github.com/alveflo/CrudMaker","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/alveflo%2FCrudMaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alveflo%2FCrudMaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alveflo%2FCrudMaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alveflo%2FCrudMaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alveflo","download_url":"https://codeload.github.com/alveflo/CrudMaker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471397,"owners_count":20944154,"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":["aspnetcore","automapper","dotnet-core","efcore","fluentvalidation","odata"],"created_at":"2024-12-19T20:16:39.891Z","updated_at":"2026-03-08T08:33:52.532Z","avatar_url":"https://github.com/alveflo.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n\u003ch1 align=\"center\"\u003e:rocket: CrudMaker\u003c/h1\u003e\n\u003c/p\u003e\n\n## Description\nCrudMaker is intended to potentially save time and energy by automatically generating CRUD-endpoints for given entities. It has a tight coupling to OData, Entity Framework Core, AutoMapper and Fluentvalidation in order to achive rich queryablity, persistance, mapping entities to dto's and building business logic into operations by utilizing validators.\n\n:warning: This repository is in an experimental stage\n\n### Dependencies\nThis project is tightly coupled to\n* [OData](https://www.odata.org/)\n* [AutoMapper](https://automapper.org/)\n* [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/)\n* [FluentValidation aspnet core](https://docs.fluentvalidation.net/en/latest/aspnet.html)\n\n### How about...\n\u003e Can I use my own controllers alongside this library?\n\nYes, you can! If you'd like to use CrudMaker to generate crud operations for e.g. a `Blog` entity and also write your own controller for a `Post` entity with more complex business logic into it, that's totally fine.\n\n\u003e CrudMaker doesn't include relations when getting data\n\nThat's easily fixed by implementing a custom repository (shown below)\n\n# Usage\nWhen setting up a CRUD-operation (as below) with CrudMaker you'll get the following endpoints:\n```csharp\nservices.AddCrud\u003cTestDbContext\u003e(options =\u003e\n{\n    options.Add\u003cBlogDto, Blog\u003e(\"/blogs\");\n});\n```\n* `GET /api/blogs` Querying blogs by using OData, e.g.:\n    * `GET /api/blogs?$select=Property1, Property2$top=10$skip=10` \n\n    (This will ofcourse return a projection to the provided dto rather than the database entity to not expose sensitive data)\n* `GET /api/blogs/{id}` Gets `Blog` by id\n* `POST /api/blogs` with provided dto as parameter\n* `PUT /api/blogs/{id}` with provided dto as parameter\n* `DELETE /api/blogs/{id}`\n\n# Setup\nFor complete setup inspiration, please visit `example/CrudMaker.TestHost`.\n\n## Configuration\n### Startup service collection configuration\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    // An EF Core database context is required\n    services.AddDbContext\u003cTestDbContext\u003e(...);\n    // AutoMapper is required\n    services.AddAutoMapper(typeof(AutoMapperProfile));\n\n    services.AddControllers();\n\n    // Endpoint routing is not supported due to OData configurations\n    services.AddMvc(option =\u003e option.EnableEndpointRouting = false)\n        // Fluent validation (aspnet core style) is recommended\n        .AddFluentValidation(...);\n\n    services.AddCrud\u003cTestDbContext\u003e(options =\u003e\n    {\n        // Adds CRUD endpoints for Post operations on /posts\n        options.Add\u003cPostDto, Post\u003e(\"/posts\");\n\n        // Adds CRUD endpoints for Blog operations on /blogs\n        // with custom repository.\n        options.Add\u003cBlogDto, Blog, BlogRepository\u003e(\"/blogs\");\n    });\n}\n```\n\n### Startup application builder configuration\n```csharp\npublic void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n{\n    ...\n    // Add CrudMaker OData support\n    app.UseCrudMakerOData();\n    app.UseEndpoints(endpoints =\u003e\n    {\n        endpoints.MapControllers();\n    });\n}\n```\n\n## Entities and dtos\nBoth entities and dtos needs to be implemented using the `CrudMaker.IIdentity` interface in order to identify entities\n```csharp\npublic class Blog : IIdentity\n{\n    public Guid Id { get; set; }\n    ...\n}\n\npublic class BlogDto : IIdentity\n{\n    public Guid Id { get; set; }\n    ...\n}\n```\n\n## Custom repositories\nCustom repositories is implemented by implementing the interface `CrudMaker.Abstractions.IRepository\u003cTEntity\u003e` and configured when configuring your service collection\n```csharp\nservices.AddCrud\u003cTestDbContext\u003e(options =\u003e\n{\n    options.Add\u003cBlogDto, Blog, BlogRepository\u003e(\"/blogs\");\n});\n```\n\n## Validation\nValidation of incoming dto's for `POST` and `PUT` is achieved by implementing `FluentValidation` validators for the entities. This is not required but it's highly recommended.\n```csharp\npublic class BlogDtoValidator : AbstractValidator\u003cBlogDto\u003e\n{\n    public BlogDtoValidator()\n    {\n        RuleFor(x =\u003e x.Property).NotEmpty();\n    }\n}\n```\n\n## Entity\u003c-\u003eDto mapping\nMapping is done using `AutoMapper` and thus need to be defined both ways in your auto mapper profile.\n```csharp\npublic class AutoMapperProfile : Profile\n{\n    public AutoMapperProfile()\n    {\n        CreateMap\u003cBlogDto, Blog\u003e()\n            .ReverseMap();\n    }\n}\n```\n\n### License\nThe MIT License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falveflo%2Fcrudmaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falveflo%2Fcrudmaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falveflo%2Fcrudmaker/lists"}