DEV Community

Cover image for Net Core important Features implementation
Jai
Jai

Posted on • Edited on

2

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 :)

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (4)

Collapse
 
insight_it_891bf8cd689700 profile image
Insight IT

Nice blog and informative content,
We are providing Best Dot NET Training in Hyderabad,
Thanks for sharing with us,
DOT NET Training in Hyderabad
DOT NET Online Training in Hyderabad

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();

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay