Web API Development in .NET 8 in 2 Hours | ASP.NET CORE | RESTFUL API
00:00:00 Introduction
00:03:06 What is Web API & Why create Web API
00:10:21 How Web API Works in Theory
00:14:49 How Web API Works (Demo with Minimal APIs)
00:27:32 What is a Web API Framework
00:33:27 ASP.NET Core Middleware Pipeline
00:37:34 Web API Controller
00:42:25 Routing in Web API
00:51:17 Model Binding
01:01:06 Model Validation with DataAnnatation
01:08:07 Model Validation with ValidationAttribute
01:15:10 Web API Return Types
01:21:30 In Mememory Repository
01:25:01 Model Validation with Action Filter
01:35:30 Read Endpoint
01:36:55 Create Endpoint
01:46:45 Validating Create Endpoint with ActionFilter
01:51:23 Update Endpoint
01:59:48 Exception Hanlding with Exception Filter
02:05:48 Delete Endpoint
روش درست کردن دمو برای پروژههای blazor در Github (یا روش توزیع پروژههای Blazor WASM در Github-Pages)
ابتدا فایل yml زیر را در پوشهی github\workflows\deploy.yml. قرار دهید (پوشهای را به این نام، در ریشهی پروژهی خود ایجاد کنید):
در این قالب، چهار مورد را باید ویرایش کنید:
- نام شاخهی اصلی پروژه؛ که یا main است و یا master.
- شماره نگارش دات نت مورد استفاده.
- مسیر فایل csproj پروژهی wasm.
- نام اصلی مخزن کد.
سپس آنرا به مخزن کد خود commit کنید. بعد به قسمت settings->pages در github مراجعه کرده و source را بر روی نام شاخهی جدید github-pages (فوق در قسمت آخر کار) قرار داده و آنرا ذخیره کنید. الان سایت دموی شما در مسیری که در همین قسمت pages پس از ذخیره سازی، نمایش میدهد، آمادهاست.
یک نکتهی مهم
چون base href، توسط action فوق اصلاح میشود تا به پوشهی نسبی محل قرارگیری برنامه اشاره کند، نیاز است navlinkها با href شروع شدهی با / نباشند؛ چون به ریشهی سایت اشاره میکنند و نه مسیر نسبی محل قرارگیری برنامه. کلا در هر قسمتی از برنامه، این نکته باید رعایت شود. مثلا اگر فونت وبی را در فایل app.css تعریف کردهاید، مسیر آن نباید با / شروع شود؛ وگرنه یافت نخواهد شد. یک مثال:
فایل app.css برنامه در مسیر wwwroot\css\app.css قرار دارد و داخل آن فایل، فونتهای پوشهی دیگر wwwroot\lib\samim-font را به صورت زیر تعریف کردهایم؛ که یعنی مسیر فونت را از ریشهی سایت پیدا کن:
این مسیر، باید به مسیر نسبی زیر که به یک پوشهی بالاتر (از محل قرار گیری app.css) اشاره میکند، اصلاح شود:
ابتدا فایل yml زیر را در پوشهی github\workflows\deploy.yml. قرار دهید (پوشهای را به این نام، در ریشهی پروژهی خود ایجاد کنید):
name: Deploy to GitHub Pages # Run workflow on every push to the main branch on: push: branches: [ main ] jobs: deploy-to-github-pages: # use ubuntu-latest image to run steps on runs-on: ubuntu-latest steps: # uses GitHub's checkout action to checkout code form the main branch - uses: actions/checkout@v2 # sets up .NET Core SDK - name: Setup .NET Core SDK uses: actions/setup-dotnet@v1 with: dotnet-version: 5.0.302 # publishes Blazor project to the release-folder - name: Publish .NET Core Project run: dotnet publish ./src/DNTPersianComponents.Blazor.WasmSample/Server/DNTPersianComponents.Blazor.WasmSample.Server.csproj -c Release -o release --nologo # changes the base-tag in index.html from '/' to 'DNTPersianComponents.Blazor' to match GitHub Pages repository subdirectory - name: Change base-tag in index.html from / to DNTPersianComponents.Blazor run: sed -i 's/<base href="\/" \/>/<base href="\/DNTPersianComponents.Blazor\/" \/>/g' release/wwwroot/index.html # copy index.html to 404.html to serve the same file when a file is not found - name: copy index.html to 404.html run: cp release/wwwroot/index.html release/wwwroot/404.html # add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore) - name: Add .nojekyll file run: touch release/wwwroot/.nojekyll - name: Commit wwwroot to GitHub Pages uses: JamesIves/github-pages-deploy-action@3.7.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: github-pages FOLDER: release/wwwroot
- نام شاخهی اصلی پروژه؛ که یا main است و یا master.
- شماره نگارش دات نت مورد استفاده.
- مسیر فایل csproj پروژهی wasm.
- نام اصلی مخزن کد.
سپس آنرا به مخزن کد خود commit کنید. بعد به قسمت settings->pages در github مراجعه کرده و source را بر روی نام شاخهی جدید github-pages (فوق در قسمت آخر کار) قرار داده و آنرا ذخیره کنید. الان سایت دموی شما در مسیری که در همین قسمت pages پس از ذخیره سازی، نمایش میدهد، آمادهاست.
یک نکتهی مهم
چون base href، توسط action فوق اصلاح میشود تا به پوشهی نسبی محل قرارگیری برنامه اشاره کند، نیاز است navlinkها با href شروع شدهی با / نباشند؛ چون به ریشهی سایت اشاره میکنند و نه مسیر نسبی محل قرارگیری برنامه. کلا در هر قسمتی از برنامه، این نکته باید رعایت شود. مثلا اگر فونت وبی را در فایل app.css تعریف کردهاید، مسیر آن نباید با / شروع شود؛ وگرنه یافت نخواهد شد. یک مثال:
فایل app.css برنامه در مسیر wwwroot\css\app.css قرار دارد و داخل آن فایل، فونتهای پوشهی دیگر wwwroot\lib\samim-font را به صورت زیر تعریف کردهایم؛ که یعنی مسیر فونت را از ریشهی سایت پیدا کن:
src: url('/lib/samim-font/Samim-Bold.eot?v=4.0.5');
src: url('../lib/samim-font/Samim-Bold.eot?v=4.0.5');
اشتراکها
تغییرات GC در دات نت 8
اشتراکها
Rider 2019.2 منتشر شد
اشتراکها
NET 9 Release Candidate 2. منتشر شد
.NET 9 Release Candidate 2 is now available!
As we prepare the general availability (GA) release of .NET 9 in November we are adding our final touches around performance, stability, and any additional optimizations to make it the best release of .NET 9. Today, we are excited to announce the release of .NET 9 Release Candidate 2. As with Release Candidate 1, this release is covered by a go-live license so you can receive support when using it in your production applications. We encourage developers today to try out this latest release and give the teams feedback on anything that you find in your development so we can incorporate any additional enhancements into the final release.
The tutorials in this repository are:
به روز رسانی
- NET Core 1.0.1. منتشر شد. با این تغییرات
برای مطالعهی بیشتر
- Announcing September 2016 Updates for .NET Core 1.0
- Announcing the ASP.NET Core September 2016 Patch Release
توضیحات بیشتری در مورد روش ارتقاء
- NET Core 1.0.1. منتشر شد. با این تغییرات
برای مطالعهی بیشتر
- Announcing September 2016 Updates for .NET Core 1.0
- Announcing the ASP.NET Core September 2016 Patch Release
توضیحات بیشتری در مورد روش ارتقاء