Blazor 5x - قسمت هفتم - مبانی Blazor - بخش 4 - انتقال اطلاعات از کامپوننتهای فرزند به کامپوننت والد
برای مثال حلقهی زیر را در نظر بگیرید:
@for( int c = 0; c < 10; c++ ) { <li> <a href="#" @onclick="@(_=> OnLinkClicked(c))">@c</a> </li> }
برخلاف تصور، با کلیک بر روی تمام لینکها، فقط عدد ثابت 10 به متد OnLinkClicked ارسال میشود. علت آن، همان نکات مطلب «بررسی مفهوم Captured Variable در زبان سی شارپ» است که در حین تشکیل حلقههای Blazor هم صادق هستند.
برای رفع این مشکل، از یکی از دو روش زیر میتوان استفاده کرد:
Capture متغیر داخل حلقه:
@for( int c = 0; c < 10; c++ ) { var current = c; <li> <a href="#" @onclick="@(_=> OnLinkClicked(current))">@current</a> </li> }
@foreach(var c in Enumerable.Range(0,10)) { <li> <a href="#" @onclick="@(_=> OnLinkClicked(c))">@c</a> </li> }
نگاهی به مشخصات SQL Server 2019
SQL Server 2019 is designed to solve challenges of the modern data professional including:
- Store enterprise data in a data lake and offer SQL and Spark query capability overall data
- Reduce the need for Extract, Transform, and Load (ETL) applications by eliminating data movement
- Integrate and secure machine learning applications with scalable performance
- Reduce the need for application and query changes to gain a boost in performance
- Increase confidential computing of data through hardware enclaves
- Increase application and database uptime and availability through features like ADR (Advanced Database Recovery)
- Extend the power of the T-SQL language in a secure and robust fashion
- Run applications and deploy databases across multiple operating systems and platforms with compatibility
- Reduce the risk of upgrades while using new SQL capabilities when you are ready though inbuilt database compatibility levels
ویژگی های پیشرفته ی AutoMapper - قسمت دوم
به طور مثال در صورتی میاره که به شکل زیر باشه
public class Customer { public Customer() { Orders = new List<Order>(); } [StringLength(10)] public string Title { get; set; } [Display(Name = "نام")] public string FirstName { get; set; } [Display(Name = "نام خانوادگی")] public string LastName { get; set; } public ICollection<Order> Orders { get; set; } }
public class CustomerViewModel { public Customer Customer{ get; set; } }
نگاهی سریع به فریم ورک های MVVM
One year ago MVVM wasn’t very famous. I remember the first article I read about it, about using MVVM to simplify the management of treeview controls. In the last six months, MVVM has been quickly promoted to THE methodology to use when developing WPF applications. During this amount of time, famous WPF developers started to merge their existing MVVM classes into libraries. Those libraries are now known as MVVM frameworks and contain classes designed to help developers to use MVVM in their projects
VSCode برای توسعه دهندگان سیشارپ
VSCode for the C# Developer - Tim Corey - NDC London 2023
VSCode is a nimble editor that can do just about anything. In this session, we will set up and configure VSCode for use in C# development. Then we will use it to build, debug, and deploy a small .NET Core web application to Azure.
Along the way, we will go over a list of the top C#-focused plugins for VSCode. Whether you are just getting started with VSCode or you are used to VSCode but want to start building C# projects, this session will get you up to speed fast.
builder.RootComponents.RegisterForJavaScript<Counter>(identifier: "counter");
builder.Services.AddServerSideBlazor(options => { options.RootComponents.RegisterForJavaScript<Counter>(identifier: "counter"); });
<button onclick="callCounter()">Call Counter</button> <script> async function callCounter() { let containerElement = document.getElementById('my-counter'); await Blazor.rootComponents.add(containerElement, 'counter', { incrementAmount: 10 }); } </script> <div id="my-counter"> </div>