اشتراک‌ها
یک تجربه جدید: برنامه های وب مبتنی بر مرورگر با .NET و Blazer

Blazor یک چهارچوب UI که توسط تیم asp.net ارائه شده و بر پایه #C و Razor و HTML است که به وسیله WebAssembly اجرا می‌شود.
Blazor فرایند تولید یک اپلیکیشن single-page سریع و زیبا را بصورت فوق العاده‌ای ساده می‌کند. 

یک تجربه جدید: برنامه های وب مبتنی بر مرورگر با .NET و Blazer
نظرات مطالب
Blazor 5x - قسمت 19 - کار با فرم‌ها - بخش 7 - نکات ویژه‌ی کار با EF-Core در برنامه‌های Blazor Server
- Context در EF، همان پیاده سازی الگوی واحد کار است.
- این تغییرات (برای Blazor Server فقط) انجام شده تا رفتاری مشابه Web API را پیدا کند که در پایان هر درخواست، سرویس‌های IDisposable را به صورت خودکار Dispose می‌کند. بنابراین با هم سازگار هستند و دقیقا از همین سرویس‌ها، در قست Blazor WASM این سری هم بدون مشکل استفاده شده‌است.
نظرات مطالب
Blazor 5x - قسمت نهم - مبانی Blazor - بخش 6 - ساده سازی تعاریف ویژگی‌های المان‌ها و انتقال پارامترها به چندین زیر سطح
یک نکته‌ی تکمیلی: روش دیگری برای انتقال اطلاعات بین کامپوننت‌هایی که در یک سلسله مراتب قرار ندارند
نظرات مطالب
Blazor 5x - قسمت اول - معرفی
سلام؛ برای اجرای Blazor در مرورگر آیا وابستگی خاصی نیاز هست ؟ مثلا زمانیکه از Blazor web assembly استفاده میکنیم کلاینت باید حتما .net core را نصب کرده باشه یا همون مرورگر برای اجرای وب اسمبلی کافی خواهد بود ؟ متشکرم.
مطالب
نکات ویژه کار با عملیات نامتقارن در Blazor Server
 در برنامه‌های Blazor Server، تنها از یک نخ رابط کاربری واحد ( single UI thread ) استفاده نمی‌شود؛ بلکه هر نخی که در دسترس باشد، می‌تواند در موقع رندر، استفاده شود. علاوه بر این اگر از عملیات نامتقارن استفاده شود، زمانیکه به کلمه‌ی کلیدی await می‌رسیم، آنگاه نخ اختصاص داده شده‌ی برای ادامه پردازش متد، ممکن است لزوما همان چیزی نباشد که آن را شروع کرده است. برای نشان دادن این موضوع مثالی را در پیش می‌گیریم.
کامپوننتی را با نام  SynchronousInitComponent با کد زیر درنظر می‌گیریم. همانطور که از اسم آن مشخص است این کامپوننت به صورت متقارن یا همزمان پیاده‌سازی شده است:
<p>Sync rendered by thread @IdOfRenderingThread</p>

@code
{
  int IdOfRenderingThread;

  protected override void OnInitialized()
  {
    base.OnInitialized();
    IdOfRenderingThread =
      System.Threading.Thread.CurrentThread.ManagedThreadId;
  }
}
در حقیقت در متد OnInitialized آن، مقدار نخ جاری را توسط Thread.ManagedThreadId به دست می‌آوریم. بنابراین شماره نخ جاری پس از رندر شدن کامپوننت، در صفحه نمایش داده می‌شود.
حال در کامپوننت دیگری برای مثال کامپوننت index، کامپوننت همزمان فوق را به شکل زیر فراخوانی می‌کنیم:
@page "/"

<h1>Components with synchronous OnInitialized()</h1>
@for (int i = 0; i < 5; i++)
{
  <SynchronousInitComponent />
}
با این نتیجه:
Components with synchronous OnInitialized()
Sync rendered by thread 4
Sync rendered by thread 4
Sync rendered by thread 4
Sync rendered by thread 4
Sync rendered by thread 4
همانطور که ملاحظه می‌نمایید شناسه نخ یکسانی برای هر فراخوانی کامپوننت نشان داده می‌شود. بدیهی است در صورتیکه شما همین کد را اجرا کنید، ممکن است شماره نخ برنامه شما با کد من یکی نباشد؛ اما نتیجه یکی است. یعنی در تمامی موارد، یک عدد مشاهده می‌شود.
حال همین آزمایش را با متدهای نامتقارن یا ناهمزمان انجام می‌دهیم. کامپوننت AsynchronousInitComponent را با کد زیر درنظر بگیرید:
<p>Async rendered by thread @IdOfRenderingThread</p>

@code
{
  int IdOfRenderingThread;

  protected override async Task OnInitializedAsync()
  {
    // Runs synchronously as there is no code in base.OnInitialized(),
    // so the same thread is used
    await base.OnInitializedAsync().ConfigureAwait(false);
    IdOfRenderingThread =
      System.Threading.Thread.CurrentThread.ManagedThreadId;

    // Awaiting will schedule a job for later, and we will be assigned
    // whichever worker thread is next available
    await Task.Delay(1000).ConfigureAwait(false);
    IdOfRenderingThread =
      System.Threading.Thread.CurrentThread.ManagedThreadId;
  }
}
این کامپوننت هم دقیقا شبیه کامپوننت قبلی است؛ با این تفاوت که IdOfRenderingThread، مجددا بعد از یک تاخیر یک ثانیه‌ای مقداردهی شده‌است. این مقداردهی سبب رندر مجدد کامپوننت با تاخیر یک ثانیه می‌شود. حال در کامپوننت دیگری، کامپوننت غیرمتقارن فوق را به شکل زیر فراخوانی می‌کنیم:
@page "/async-init"

<h1>Components with asynchronous OnInitializedAsync()</h1>
@for (int i = 0; i < 5; i++)
{
  <AsynchronousInitComponent/>
}
با اجرا کردن برنامه، دقیقا نتایج، شبیه نتایج نتایج کامپوننت متقارن می‌باشد:
Components with asynchronous OnInitializedAsync()
Async rendered by thread 4
Async rendered by thread 4
Async rendered by thread 4
Async rendered by thread 4
Async rendered by thread 4
اما تنها بعد از یک ثانیه (await Task.Delay(1000)) ، متدهای OnInitializedAsync کامپوننت‌ها، به پایان می‌رسند و مقدار IdOfRenderingThread را پیش از به پایان رسیدن رندر صفحه، به روز رسانی می‌نمایند. اینبار، دیگر مقادیر نخ‌ها متفاوت خواهند بود:
Components with asynchronous OnInitializedAsync()
Async rendered by thread 7
Async rendered by thread 18
Async rendered by thread 10
Async rendered by thread 13
Async rendered by thread 11
با توجه به مطالب مطرح شده به این نتیجه می‌رسیم که این موضوع می‌تواند هنگام استفاده از یک وابستگی غیر ایمن ( non-thread-safe dependency ) مانند DBContext در چندین کامپوننت باعث بروز مشکل شود. نمونه‌ای از نحوه‌ی رویارویی با مشکلات احتمالی آن، در اینجا و اینجا بررسی شده‌است.  
اشتراک‌ها
شماره ویژه CODE Magazine مخصوص دات نت 7

As Microsoft launches .NET 7, CODE Focus offers high quality insights right from the teams responsible for designing and improving the product. Dig into articles about C# 11, .NET MAUI, Blazor, EF Core 7, CoreWCF and better tools to upgrade your existing .NET and ASP.NET applications to the latest release. Plus performance enhancements everywhere! This is an amazing release. 

شماره ویژه CODE Magazine مخصوص دات نت 7
اشتراک‌ها
گزینه‌های مختلف تولید برنامه‌های دسکتاپ دات نتی

The desktop is here to stay. Sam Basu reviews how you can take advantage of the latest in .NET technologies and still build the apps your customers demand. 

Sam covers Windows Forms, XAML (UWP, WinUI), Progressive Web Apps, Electron, Blazor Mobile Bindings, .NET MAUI and building for Mac OS and Linux.  

گزینه‌های مختلف تولید برنامه‌های دسکتاپ دات نتی
اشتراک‌ها
منتشر شد Blazor WebAssembly 3.2.0 Preview 4
A new preview update of Blazor WebAssembly is now available! Here’s what’s new in this release:

  • Access host environment during startup
  • Logging improvements
  • Brotli precompression
  • Load assemblies and runtime in parallel
  • Simplify IL linker config for apps
  • Localization support
  • API docs in IntelliSense 
منتشر شد Blazor WebAssembly 3.2.0 Preview 4
نظرات مطالب
ارسال پیام های تبلیغاتی به Telegram با استفاده از #C
چند نمونه دموی برنامه هایی که من دیدم از خود برنامه وایبر در دسکتاب استفاده  می‌کنند. به این صورت که، زدن کلیدهای روی برنامه سیموله شده. ولی در مورد تلگرام قضیه فرق میکنه خود شرکت از استفاده از API استقبال میکنه:

Using Telegram API
Our API is 100% open for all developers who wish to create Telegram applications on our platform
 Feel free to study the open source code of existing Telegram applications for examples of how things work here
اشتراک‌ها
دوره سه ساعته آموزش Blazor

00:00:00 Introduction
00:03:07 Blazor Project Structure
00:12:14 How Blazor Works
00:20:28 What is an Inventory Management System
00:23:47 Introduction to Clean Architecture
00:30:58 Null Reference Type in .NET 6
00:36:44 Write the View Inventories Use Case
00:45:16 Implement the View Inventories Use Case
00:59:27 Create a Plugin with Dependency Injection
01:08:45 Inject the Use Case in Razor Component
01:17:35 Dependency Injection in Blazor
01:28:08 Page Component - Create the Inventory List Page
01:34:34 SPA Components Best Practice
01:38:07 Databinding and EventCallback in Search Inventory Component
01:52:59 Component Parameters in Inventory List Component
02:03:52 Null Checks
02:06:07 Extract the Inventory List Item Component
02:09:45 Add Inventory Use Case
02:12:10 Implement Add Inventory Repository Methods
02:15:34 NavigationManager
02:17:56 EditForm and Data Validation
02:30:09 Edit Inventory Use Case
02:35:12 Implement Edit Inventory Repository methods
02:43:00 Receive Routing Parameters
02:50:09 Implement Edit Inventory Component
03:03:06 Why we are using Async everywhere 

دوره سه ساعته آموزش Blazor