DEV Community

Cover image for Net Core important Features implementation
Jai
Jai

Posted on • Edited on

Net Core important Features implementation

As .Net core(version used here is 2.1) is becoming popular day by day, here are some projects I created which might come handy. (added comments in the code for better understanding). Whichever functionality you want to test just set those web API project as startup project and you are good to go.

Repository: https://github.com/jai00271/AspCoreGuide

1. Extending Service and cors implementation:

In this project, we moved all the service injection logic to a different class. We should avoid putting all service injection logic inside ConfigureServices method. Also when we are using .Net core with the client-side project like Angular or react we should take care of cors issue as well.

Project Name: BasicProjectSetup


2. Log implementation:

This project contains an implementation of logging feature provided by default with .Net core.

Project Name: LoggingImplementation


3. Entity Framework implementation:

This project contains 2 things:

a. How to Entity framework with SQL server
b. Implementation via Repository design pattern

Nugets used: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools (Project: EFImplementation.Repository)

Folder Name: EFImplementation

refer this for more understanding of EF implementation in .Net core


4. Error handling:

This project contains 3 things:

a. Custom Log implementation by extending NLog.Extensions.Logging
b. Built in .Net core middleware implementation
c. Custom middleware implementation

Folder Name: Errorhandling

Nugets usd: NLog.Extensions.Logging(Project: LoggerService)


5. Implementing Swagger in Web API

This project contains swagger implementation.

Project Name: SwaggerImplementation

Nuget used: Swashbuckle.AspNetCore(Project: SwaggerImplementation)


6. Working with XUnit Test Framework

This project helps in understanding how XUnit framework works.

Folder Name: XUnitTest

Nuget used: Microsoft.AspNetCore.App(Project: Learn.UnitTest)


Repository: https://github.com/jai00271/AspCoreGuide

  • Refernce article

Code: https://code-maze.com
Cover Image: Image source

Please share your valuable feedback, as it will help me write better :)

Top comments (3)

Collapse
 
jai00271 profile image
Jai

Thanks Wiliam. I'll fix it soon.

Collapse
 
glenmccallumcan profile image
Glen McCallum

Clean the way you moved the service injection logic outside of ConfigureServices into ServicesExtensions class.

Collapse
 
jai00271 profile image
Jai

Hi Glen,

thanks for your reply. May I know which project are you referring to? Is it BasicProjectSetup.

If yes, do you mean to keep both below lines in one method call instead of 2 in startup:

services.ConfigureCors();
services.InjectServices();