cloudnative-netcore / netcorekit Goto Github PK
View Code? Open in Web Editor NEW:heartpulse: A crafted toolkit for building cloud-native apps on the .NET platform
Home Page: https://vietnam-devs.github.io/
License: MIT License
:heartpulse: A crafted toolkit for building cloud-native apps on the .NET platform
Home Page: https://vietnam-devs.github.io/
License: MIT License
At the moment, MySQL Provider couldn't work with TransactionScope. I don't know why, will have a look at it
References:
Microsoft.Hadoop.Avro.AvroSerializer
to seri/deserializer messageStep 3: run command on the project
kubectl apply -f samples/TodoApi/k8s
sould be
kubectl apply -f samples/TodoApi/App_Build/k8s
We need the cache because it needs for the enterprise application.
Reference at https://github.com/fals/cqrs-clean-eventual-consistency/blob/master/src/Ametista.Infrastructure/Cache/RedisCache.cs
Sample can be found at https://github.com/RSuter/ShopOnCore/blob/master/src/docker-compose.override.yml
https://github.com/secana/CakeApp
// Possibly building the Event Application
https://github.com/saineshwar/ASP.NET-CORE-MVC-Project-Event-Management
I found out the best library for handling problem details that implemented by @khellang at https://github.com/khellang/Middleware/blob/master/samples/ProblemDetails.Sample/Program.cs
At the moment, NetCoreKit.Infrastructure.AspNetCore.All
assembly contains EfCore
for migration (MigrationController). We need to separate it out, then other templates like standard
and mongo
don't pull EfCoreFramework in release mode.
At the moment, we use JSON for formatter, but we can event do it better via using MessagePack. Need considering to add a feature toogle
, then we can switch between JSON and MessagePack when need.
We can do more works just like https://github.com/EduardoPires/EquinoxProject/blob/master/src/Equinox.WebApi/Configurations/WebApiServiceCollection.cs#L14
Reference at https://dotnetthoughts.net/using-message-pack-with-asp-net-core/
I think you should write the code like this
var results = await queryable
.Skip((criterion.CurrentPage -1) * criterion.PageSize)
.Take(criterion.PageSize)
.Select(selector)
.ToListAsync();
Sometimes, we need to look around and have a look at some of good architecture OSSes as below
Backend:
Microservice FW:
Frontend:
Currently, we have an endpoint http://<ip>:<port>/db-migration
, that will run the database migration when we enter. But we can do better by creating a console project that takes care of migrating and then configure Kubernetes job to run just onetime.
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)
{
}
}
We have very simple gRPC code, and hard to use now. That'd be great if we can wrap it and introduce a easy version of gRPC server, just like https://github.com/malijs/mali
Reference to vietnam-devs/coolstore-microservices#12
Distributed communication via Kafka Event Bus with protobuf protocol
Currently, Kafka only works on the local machine. We need to investigate how to make it work well on Kubernetes
How to choose the number of topics/partitions in a Kafka cluster?
https://github.com/zarusz/SlimMessageBus
References
brotli came out for a long time. It makes compression for the text file (JavaScript, CSS, HTML) more effective. We all know that it will ship with .NET 2.2 very soon. Just keep here to remember!
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:
Trying to using Polly OSS with gRPC. The basic proposal by gRPC team at https://github.com/grpc/proposal/blob/master/A6-client-retries.md. We can implement the middleware just like golang
at https://github.com/grpc-ecosystem/go-grpc-middleware/tree/master/retry
The same with what https://github.com/shouldly/shouldly done
cake build
tool and AppVeyor
CI
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 /appARG 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 80FROM 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 /appFROM build AS publish
RUN dotnet publish NetCoreKit.Samples.TodoApi.csproj--no-restore -c Release -o /appFROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "NetCoreKit.Samples.TodoApi.dll"]
build complete successfully.
Currently, we have it at NetCoreKit.Infrastructure.AspNetCore\Rest
, but we ought to separate it out to NetCoreKit.Infrastructure.AspNetCore.RestClient
Check if we can make the configuration re-load in the run-time. That's mean that we need to detect and reload when the environment variables changes (not sure it can work).
References:
OpenCensus should be considered https://github.com/census-instrumentation/opencensus-csharp
The sample can be found at https://www.olivercoding.com/2018-07-22-prometheus-dotnetcore/
We would like to build an event pub/sub on top of current MediatR, then we can demonstrate about eventual consistency between 2 Bounded Contexts, or even with Realtime notification.
It is good if we can do a healthy check for various of data sources and services out there.
Consider using https://github.com/Xabaril/BeatPulse with UI endpoint for this libs
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;"
.NET Core 3.0 is coming with high ability to work with gRPC for the whole stack. Let get it work by add gRPC for building the cloud-native apps.
Reference:
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:
Something like
public interface IExternalSystem {
bool Connect();
}
3 type of templates that we need to support:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.