@manhng

Welcome to my blog!

Asp.Net Core Web Api

January 31, 2021 09:46

Asp.Net Core Web Api (edit)

https://www.talkingdotnet.com/clean-way-to-add-swagger-asp-net-core-application/

https://www.talkingdotnet.com/create-petstore-like-swagger-ui-asp-net-core-web-api/

https://www.talkingdotnet.com/add-swagger-to-asp-net-core-2-0-web-api/

https://www.talkingdotnet.com/support-multiple-versions-of-asp-net-core-web-api/

https://stackoverflow.com/questions/38784537/use-jwt-authorization-bearer-in-swagger-in-asp-net-core/47709074#47709074

https://petstore.swagger.io/

https://exceptionnotfound.net/setting-aspnetcore_environment-using-a-web-config-file/

C# is the best

https://github.com/exceptionnotfound/CSharpInSimpleTerms

This series is also available as a PDF; you can download it from here.

As always, pull requests are welcome!

  1. Introduction
  2. The Type System
  3. Primitive Types, Literals, and Nullables
  4. Casting, Conversion, and Parsing
  5. Operators
  6. Code Blocks, Basic Statements, and Loops
  7. Methods, Parameters, and Arguments
  8. Classes and Members
  9. Structs and Enums
  10. Inheritance and Polymorphism
  11. Interfaces and Abstract Classes
  12. Namespaces
  13. Exceptions and Exception Handling
  14. Arrays and Collections
  15. LINQ Basics
  16. Generics
  17. Tuples and Anonymous Types
  18. Attributes and Reflection
  19. Expressions, Lambdas, and Delegates
  20. String Manipulation and Cultures
  21. Dates and Times
  22. Indexers
  23. Iterators

Logging

https://www.exceptionnotfound.net/using-middleware-to-log-requests-and-responses-in-asp-net-core/

Rest Libraries

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.

https://github.com/reactiveui/refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.

new JsonSerializerSettings {
                ContractResolver = new SnakeCasePropertyNamesContractResolver() ...
new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver() ...

Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit

https://github.com/canton7/RestEase/

Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit

Swagger UI (OpenApi) with Authorization code flow + PKCE using Swashbuckle ASP.NET Core

https://lurumad.github.io/swagger-ui-with-pkce-using-swashbuckle-asp-net-core/ (HAY HAY HAY)

ASP.NET Core Swagger UI Authorization using IdentityServer4

https://www.scottbrady91.com/Identity-Server/ASPNET-Core-Swagger-UI-Authorization-using-IdentityServer4/ (HAY HAY HAY)

SECURING AN ASP.NET CORE API WHICH USES MULTIPLE ACCESS TOKENS

https://damienbod.com/2020/12/03/securing-an-asp-net-core-api-which-uses-multiple-access-tokens/ (HAY HAY HAY)

A sample for using Swashbuckle Swagger v5.5.1 with Jwt Token support

https://github.com/capcom923/MySwashBuckleSwaggerWithJwtToken (HAY HAY HAY)

https://www.talkingdotnet.com/define-a-custom-environment-in-asp-net-core/

    public const string QAEnvironment = "QA";
    public const string UATEnvironment = "UAT";
    public const string TestEnvironment = "Test"

TechMindFactory.com

Microsoft Azure AD + ASP.NET Core Web API

https://joonasw.net/

https://pradeeploganathan.com/

TechMindFactory.com

Sample ASP.NET Core API requiring Azure AD authentication

This app was made for my blog article series where we look at testing Azure AD-protected APIs.

  1. https://joonasw.net/view/testing-azure-ad-protected-apis-part-1-swagger-ui
  2. https://joonasw.net/view/testing-azure-ad-protected-apis-part-2-postman
  3. https://joonasw.net/view/testing-azure-ad-protected-apis-part-3-automated-integration-tests
  4. https://joonasw.net/view/testing-azure-ad-protected-apis-part-4-github-actions-ci-workflow
  5. https://joonasw.net/view/testing-azure-ad-protected-apis-part-5-pipelines-in-azure-devops

Bearer JWT (Server generate token)

https://pradeeploganathan.com/security/jwt/

https://pradeeploganathan.com/security/jwt-tokenserver/ (JWT – CREATING A TOKEN SERVER)

https://pradeeploganathan.com/angular/jwt-angular-interceptor/

Serialize Exceptions as JSON

https://pradeeploganathan.com/api/serialize-exceptions-as-json-using-custom-middleware-in-net-core/

ISO 8601 Date

The formats for an ISO8601 date are as follows:

  • Year: YYYY (2018)
  • Year and month: YYYY-MM (2018-04)
  • Complete date: YYYY-MM-DD (2018-04-25)
  • Complete date plus hours and minutes: YYYY-MM-DDThh:mmTZD (2018-04-25T18:00+01:00)
  • Complete date plus hours, minutes, and seconds: YYYY-MM-DDThh:mm:ssTZD (2018-04-25T18:00:30+01:00)
  • Complete date plus hours, minutes, seconds, and a decimal fraction of a second: YYYY-MM-DDThh:mm:ss.sTZD (2018-04-25T18:00:30.45+01:00)

The letters used in the above format are:

  • YYYY: Four-digit year
  • MM: Two-digit month (01 = January, and so on)
  • DD: Two-digit day of month (01 through 31)
  • hh: Two digits of hour (00 through 23, a.m./p.m. NOT allowed)
  • mm: Two digits of minute (00 through 59)
  • ss: Two digits of second (00 through 59)
  • s: One or more digits representing a decimal fraction of a second
  • TZD: Time zone designator (Z or +hh:mm or -hh:mm)

ASP.NET Core Web API with Entity Framework Core

January 13, 2020 23:59

ASP.NET Core Web API with Entity Framework Core (edit)

CRUD Operation in ASP.NET Core Web API with Entity Framework Core

https://www.codeproject.com/Articles/1259484/CRUD-Operation-in-ASP-NET-Core-Web-API-with-Entity

https://github.com/mukeshkumartech/CRUD-AspNetCore-WebAPI

ASP.NET Core 2.1 - Implement Entity Framework Core In A Code First Approach

https://www.c-sharpcorner.com/article/entity-framework-core-a-code-first-approach/

ASP.NET Core Web API with EF Core DB-First Approach

https://code-maze.com/asp-net-core-web-api-with-ef-core-db-first-approach/

https://github.com/CodeMazeBlog/ef-db-first

How To Quickly Create A New Database Using EntityFramework Core On ASP.Net Core

CompatibilityVersion.Version_2_1

http://bekenty.com/entityframework-core-asp-net-core/

https://github.com/BekenJB/EmployeeManagerWithEFCore

Xóa bản ghi trùng lặp trong SQL Server Table

WITH student_cte AS (
    SELECT 
        First_Name, 
		Last_Name,
		Phone, 
        ROW_NUMBER() OVER(
            PARTITION BY 
                First_Name, 
                Last_Name, 
                Phone
            ORDER BY 
                First_Name, 
                Last_Name, 
                Phone
        ) rn
     FROM dbo.Students
)
select * from student_cte;
WITH student_cte AS (
    SELECT 
        First_Name, 
		Last_Name,
		Phone, 
        ROW_NUMBER() OVER(
            PARTITION BY 
                First_Name, 
                Last_Name, 
                Phone
            ORDER BY 
                First_Name, 
                Last_Name, 
                Phone
        ) rn
     FROM dbo.Students
)
DELETE FROM student_cte WHERE rn >1;

MongoDB

January 25, 2019 11:38

MongoDB (edit)

MongoDB Transactions

Working with MongoDB Transactions with C# and the .NET Framework

Software's needed:

Samples

yogyogi/First-ASP.NET-Core-Microservice: First ASP.NET Core Microservice with Web API CRUD Operations on a MongoDB database [Clean Architecture] (github.com)

fpetru/WebApiMongoDB: Using MongoDB with ASP.NET Web API and ASP.NET Core to perform CRUD operations and build a NotebookApp (github.com)

C# and MongoDB Delete Operation

C# and MongoDB Delete Operation (github.com)

First ASP.NET Core Microservice with Web API CRUD Operations on a MongoDB database [Clean Architecture]

First ASP.NET Core Microservice with Web API CRUD Operations on a MongoDB database [Clean Architecture] (hosting.work)

Getting Started with ASP.NET Core and MongoDB

Getting Started with ASP.NET Core and MongoDB - Code Maze (code-maze.com)

ASP.NET Core series

.NET Core Tutorial - Creating the restful Web API - Code Maze (code-maze.com)

ASP.NET Core Microservices series

This tutorial is a part of ASP.NET Core Microservices series. It contains the following tutorials:

CRUD Operations Using ASP.NET Web API, MongoDB, and Angular 8

  • Angular 8
  • CRUD
  • MongoDB
  • ASP.NET Core WEB API
  • Cross-Origin Resource Sharing (CORS)

CRUD Operations Using ASP.NET Web API, MongoDB, and Angular 8 - DZone Web Dev

Terminology and Concepts

If you're not familiar with MongoDB, here's a quick translation cheat sheet to get you familiar with the terminology.

SQL Server MongoDB
Database Database
Table Collection
Index Index
Row Document
Column Field
Joining Linking & Embedding
Partition Sharding (Range Partition)
Replication ReplSet

IIS + System.DirectoryServices + Use C# to manage IIS + IIS Manager

October 10, 2018 22:23

Use C# To Manage IIS - Using System.DirectoryServices namespace (edit)

https://stackoverflow.com/questions/24124644/to-get-the-hosted-web-sites-names-from-iis

Use C# to manage IIS

https://www.codeproject.com/Articles/99634/Use-C-to-manage-IIS

Programmatically Manage IIS

https://www.codeproject.com/Articles/31293/Programmatically-Manage-IIS

Windows XP IIS Manager v1.7

https://www.codeproject.com/Articles/9860/Windows-XP-IIS-Manager-v

Need to install the "IIS Metabase and IIS 6 configuration compatibility 

Read more: https://drive.google.com/file/d/19G0_FwXX-odXPnXTk6jVBWCipBODFZdV/

https://docs.oracle.com/cd/E98457_01/opera_5_6_core_help/installing_oeds_on_windows_7_workstation_web_server_IIS_asp_dot_net.htm

https://social.technet.microsoft.com/Forums/windows/en-US/11501684-3e3a-476c-afcd-3b449a4da3c9/iis-6-metabase-and-iis-6-configuration-compatibility-install?forum=w7itproinstall

https://www.activexperts.com/support/network-monitor/online/iis6metabase/

Creating Web API in ASP.NET Core 2.0

https://www.codeproject.com/Articles/1264219/Creating-Web-API-in-ASP-NET-Core-2-0

Categories

Recent posts