Code Monkey home page Code Monkey logo

netcorekit's Introduction

Cloud-native .NET Core Kit

Build status Price version

A set of cloud-native tools and utilities for .NET Core.

The goal of this project is implement the most common used cloud-native technologies (cloud-agnostic approach, containerization mechanism, container orchestration and so on) and share with the technical community the best way to develop great applications with .NET Core.

Give a Star! โญ

If you liked netcorekit project or if it helped you, please give a star โญ for this repository. That will not only help strengthen our .NET community but also improve cloud-native apps development skills for .NET developers in around the world. Thank you very much ๐Ÿ‘

Check out my blog or say hi on Twitter!

Features

  • Simple libraries. No frameworks. Little abstraction.
  • Opt-in and out of the box features with Feature Toggles technique.
  • Adhere to twelve-factor app paradigm and more.
  • Authentication/Authorization with OAuth 2.0 and OpenID Connect.
  • Domain-driven Design in mind.
  • Simply Clean Architecture supports.
  • Generic repository for data persistence.
  • Mapping between domain entity to DTO and vice versa.
  • Clean and demystify error, debug logs.
  • Resilience and health check out of the box.
  • MessagePack for WebAPI and gRPC for internal services.
  • Easy for configuration management.
  • API versioning from Docker container to WebAPI.
  • Documentation template with OpenAPI documentation.
  • Work natively with Kubernetes or even with Service Mesh(Istio).

Less code to get starting

Small, lightweight, cloud-native out of the box, and much more simple to get starting with miniservices approach. Why miniservices?

Look how simple we can start as below:

  • Standard template - NetCoreKit.Template.Standard: without storage, merely calculation and job tasks:
public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    services.AddStandardTemplate();
  }

  public void Configure(IApplicationBuilder app)
  {
    app.UseStandardTemplate();
  }
}
  • EfCore template - NetCoreKit.Template.EfCore: with Entity Framework Core (SQL Server, MySQL, and SQLite providers) comes along with the generic repository in place:
public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    services.AddEfCoreTemplate<TodoListDbContext>(svc => svc.AddEfCoreMySqlDb());
  }

  public void Configure(IApplicationBuilder app)
  {
    app.UseEfCoreTemplate();
  }
}

EfCore template usage can be found at TodoApi Sample.

  • MongoDb template - NetCoreKit.Template.MongoDb: with NoSQL (MongoDb provider) comes along with the generic repository in place:
public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    services.AddMongoTemplate();
  }

  public void Configure(IApplicationBuilder app)
  {
    app.UseMongoTemplate();
  }
}

MongoDb template usage can be found at BiMonetaryApi Sample.

Microservice architecture

msa_architecture

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :p

netcorekit's People

Contributors

thangchung avatar thinhnotes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netcorekit's Issues

Add avro on the top of Kafka for decoupling message schema

Good architecture

Route debug in aspnet 2.2

At the moment, we hit some issues when tried to run the app in container. We need some way to debug the route in aspnetcore 2.2 apps. Almost old debug libs were out of date.

Reference:

Support simple authorize with policy

Just like https://github.com/EduardoPires/EquinoxProject/blob/master/src/Equinox.WebApi/Startup.cs#L61, but we will put it into the configuration (consider using feature toggle), then just do something like

appsettings.json

"Features": {
	"Authz": {
		"CanWriteCustomerData": {
			"Customers": "Write"
		},
		"CanRemoveCustomerData": {
			"Customers": "Remove"
		}
	}	
}

Then in the CustomerController.cs

[Authorize]
public class CustomerController : ApiController
{
	[HttpPost]
    [Authorize(Policy = "CanWriteCustomerData")]
    [Route("customer-management")]
    public IActionResult Post([FromBody]CustomerViewModel customerViewModel)
    {
		
	}
}

Kafka for service bus

Dapper consideration

Because legacy system might only has Store Procedure which contains all business logic there so that we need to have a way to work effectively with this kind of work. Dapper is the best choice due to the stable and flexible when working with this scenario.

Ref:

Add multiple dbcontext

Is it possible to add multiple EFcore DB context so that I can use two different SQL databases? I tried it by making some adjustments in the code but it is not working. Can anyone share the code snippet about how to handle multiple database contexts? I tried it but the second dbcontext overriding the first dbcontext.

FYI: I have two databases and both are on the SQL Server but on different servers.

"db1": "Server=server1;Database=db1;User Id=userid;Password=password;MultipleActiveResultSets=True;",
"db2": "Server=server2;Database=db2;User Id=userid;Password=password;MultipleActiveResultSets=True;"

Error when Build sample Todoapi contianer

Follow the Guide Step by Step

When buile image vndg/todoapi, Error occures

Step 13/20 : RUN dotnet restore -nowarn:msb3202,nu1503
 ---> Running in 446fcef1b174
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
The command '/bin/sh -c dotnet restore -nowarn:msb3202,nu1503' returned a non-zero code: 1
Step 14/20 : RUN dotnet build --no-restore -c Release -o /app
 ---> Running in 039bbdd99b2b
Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
The command '/bin/sh -c dotnet build --no-restore -c Release -o /app' returned a non-zero code: 1

After editing sample/Todoapi/Dockerfile by adding detail project name to restore/build/publish cmds

FROM microsoft/dotnet:2.1.5-aspnetcore-runtime-alpine AS base
WORKDIR /app

ARG service_version
ENV SERVICE_VERSION ${service_version:-0.0.1}

ARG api_version
ENV API_VERSION ${api_version:-1.0}

ENV ASPNETCORE_URLS http://+:80
EXPOSE 80

FROM microsoft/dotnet:2.1.403-sdk-alpine AS build
WORKDIR .
COPY . .

WORKDIR /samples/TodoApi

RUN dotnet restore NetCoreKit.Samples.TodoApi.csproj -nowarn:msb3202,nu1503
RUN dotnet build NetCoreKit.Samples.TodoApi.csproj --no-restore -c Release -o /app

FROM build AS publish
RUN dotnet publish NetCoreKit.Samples.TodoApi.csproj--no-restore -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "NetCoreKit.Samples.TodoApi.dll"]

build complete successfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.