{"id":22726039,"url":"https://github.com/superwalnut/dotnet-console-app-template","last_synced_at":"2025-04-13T20:46:33.868Z","repository":{"id":119283491,"uuid":"293453318","full_name":"superwalnut/dotnet-console-app-template","owner":"superwalnut","description":"This is a project template for .Net Core 3.1 console app, pre configured Autofac, Serilog, AutoMapper, Newtonsoft.Json","archived":false,"fork":false,"pushed_at":"2020-09-11T08:02:51.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T20:46:30.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/superwalnut.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-09-07T07:25:39.000Z","updated_at":"2025-04-10T01:54:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"14b4e72e-e072-4457-8b0e-9818dbc6609e","html_url":"https://github.com/superwalnut/dotnet-console-app-template","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/superwalnut%2Fdotnet-console-app-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fdotnet-console-app-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fdotnet-console-app-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superwalnut%2Fdotnet-console-app-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superwalnut","download_url":"https://codeload.github.com/superwalnut/dotnet-console-app-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782275,"owners_count":21160716,"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":[],"created_at":"2024-12-10T16:15:33.198Z","updated_at":"2025-04-13T20:46:33.862Z","avatar_url":"https://github.com/superwalnut.png","language":"C#","funding_links":["https://ko-fi.com/Z8Z61I9HB"],"categories":[],"sub_categories":[],"readme":"# Project Template - .Net Core 3.1 Console app + Autofac + Serilog + AutoMapper\n\n\u003e This is a project template for .Net Core 3.1 Console app,\n    pre-configured Autofac, Serilog, AutoMapper, Newtonsoft.Json\n    using `dotnet new -i Superwalnut.NetCoreConsoleTemplate` to install project as a template,\n    And using `dotnet new core-console-autofac` to create a project with the template.\n\n**Pre-request**\n\n- .Net Core 3.1\n- [Autofac](https://autofac.org/)\n- [Serilog](https://serilog.net/)\n- [AutoMapper](https://automapper.org/)\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Support](#support)\n- [License](#license)\n\n---\n\n## Features\n\n\u003e This is a development project template, it is NOT production ready. It only kickstarting your project so that you don't need to build from scratch.\n\n1. pre-Configured Autofac 5.2.0 registrations setup.\n2. pre-Configured Serilog 2.9.0 console sinks.\n3. pre-Configured AutoMapper 10.0.0.\n4. pre-Installed Newtonsoft.Json 12.0.3\n\n---\n\n## Installation\n\n- Using `dotnet new -i \u003cpackage\u003e` to install the project template from nuget [Superwalnut.NetCoreConsoleTemplate](https://www.nuget.org/packages/Superwalnut.NetCoreConsoleTemplate/)\n\n```shell\n$ dotnet new -i Superwalnut.NetCoreConsoleTemplate\n```\n\nYou should see '.Net Core Console Autofac+Serilog' in your template list by `dotnet new -l`\n\n- Using `dotnet new core-console-autofac -n \u003cyour-project-name\u003e` to create a project with your own project name using this template\n\n```shell\n$ dotnet new core-console-autofac -n NetCoreDemo -o NetCoreDemo\n```\n\nThis creates a project in folder `NetCoreDemo`\n\n---\n\n\n## Documentation\n\n### Pre-configured Autofac \n\nContainerBuilder() that you can populate IServiceCollection and register your autofac modules in Startup.cs. Taking ConsoleModule from the template as an example, you can also create modules for your Service Layer, Repository Layer, etc.\n\n```c#\n        public IServiceProvider ConfigureServices(IServiceCollection services)\n        {\n            ...\n            builder.RegisterModule\u003cConsoleModule\u003e();\n\n            var container = builder.Build();\n            return container.Resolve\u003cIServiceProvider\u003e();\n        }\n```\n\nSerilog \u0026 Automapper are registered in the ConsoleModule,\n\n```c#\n    public class ConsoleModule : Module\n    {\n        protected override void Load(ContainerBuilder builder)\n        {\n            builder.AddAutoMapper(x=\u003ex.AddProfile\u003cMyAutoMapperProfile\u003e());\n        }\n    }\n```\n\n### Pre-configured Serilog \n\nWith console sinks in the appsettings.json\n\n```json\n  \"Serilog\": {\n    \"Using\": [ \"Serilog.Sinks.Console\" ],\n    \"MinimumLevel\": \"Information\",\n    \"WriteTo\": [\n      {\n        \"Name\": \"Console\"        \n      }\n    ]\n  }\n```\n\nAnd Serilog configuration in the startup.cs\n\n```c#\n        public static void CreateLogger(IConfigurationRoot configuration)\n        {\n            Log.Logger = new LoggerConfiguration()\n                .MinimumLevel.Debug()\n                .MinimumLevel.Override(\"Microsoft\", LogEventLevel.Information)\n                .Enrich.FromLogContext()\n                .ReadFrom.Configuration(configuration)\n                .CreateLogger();\n        }\n```\n\n### Pre-configured AutoMapper \n\nWith created example profile,\n\n```c#\n    public class MyAutoMapperProfile : Profile\n    {\n        public MyAutoMapperProfile()\n        {\n            CreateMap\u003cFoo, FooDto\u003e();\n            ...\n        }\n    }\n```\n\nAnd register the profile in ConsoleModule for AutoMapper,\n\n```c#\n    public class ConsoleModule : Module\n    {\n        protected override void Load(ContainerBuilder builder)\n        {\n            ...\n            builder.AddAutoMapper(x=\u003ex.AddProfile\u003cMyAutoMapperProfile\u003e());\n        }\n    }\n```\n\n## Support\n\nReach out to me at one of the following places!\n\n- [Follow me @ Github](https://github.com/superwalnut)\n\n- [Twitter](https://twitter.com/superwalnuts)\n\n- [![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Z8Z61I9HB)\n\n---\n\n## License\n\n[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)\n\n- **[MIT license](http://opensource.org/licenses/mit-license.php)**\n\n-------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperwalnut%2Fdotnet-console-app-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperwalnut%2Fdotnet-console-app-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperwalnut%2Fdotnet-console-app-template/lists"}