اشتراک‌ها
مسیر راه ASP.NET Core در دات نت 7

This issue represents the list of major investments our team will focus on during the .NET 7 timeframe. It does not include all the features and bugfixes we will be tackling during this time. 

مسیر راه ASP.NET Core در دات نت 7
اشتراک‌ها
Babel 7.8.0 منتشر شد

The popular JavaScript transpiler now supports ECMAScript 2020 features by default with no plugins needed for nullish coalescing (??), optional chaining (?.) and dynamic import(). Work is also underway on Babel 8 with two upcoming issues outlined in this post too. 

Babel 7.8.0 منتشر شد
نظرات مطالب
پیاده سازی CQRS توسط MediatR - قسمت دوم
بهتره در CQRS برای افزایش کارایی، قابلیت مقیاس پذیری و امنیت، از دو تا دیتابیس استفاده بشه 

The query model for reading data and the update model for writing data can access the same physical store, perhaps by using SQL views or by generating projections on the fly. However, it's common to separate the data into different physical stores to maximize performance, scalability, and security, as shown in the next figure. 
اشتراک‌ها
از کند شدن Entity Framework دوری کنید
Generally speaking, I don't worry much about tweaking my LINQ queries when working with Entity Framework (this is also true when I'm working with SQL directly, by the way). I'm always telling my clients that if they want to speed up their data access they should look at their database design and, especially, how they're using indexes.
از کند شدن Entity Framework دوری کنید
بازخوردهای دوره
مدیریت نگاشت ConnectionIdها در SignalR به کاربران واقعی سیستم
- کلاینت سمت کاربر SiganlR که درون مرورگر اجرا می‌شود، اساسا جاوا اسکریپتی است. (البته برای جاوا یا دات نت و امثال آن هم کلاینت مخصوص دارد؛ ولی بحث مرورگر آن مشخص است)
+ این متد خاص هاب سمت سرور، در آخرین نگارش SiganlR به این نحو تغییر کرده‌است:
public override Task OnDisconnected(bool stopCalled)
{
    if (stopCalled)
    {
        // We know that Stop() was called on the client,
        // and the connection shut down gracefully.
    }
    else
    {
        // This server hasn't heard from the client in the last ~35 seconds.
        // If SignalR is behind a load balancer with scaleout configured, 
        // the client may still be connected to another SignalR server.
    }

    return base.OnDisconnected(stopCalled);
}
اگر پارامتر stopCalled با مقدار true فراخوانی شد، یعنی سمت کلاینت، با استفاده از کدهای جاوا اسکریپتی SignalR (فراخوانی شده به صورت خودکار در حین بستن یک تب یا مرورگر یا به صورت دستی به نحوی که عنوان شد)، درخواست بسته شدن صفحه را داده‌است. اگر مقدار آن false بود، یعنی سرور تشخیص داده‌است که در طی 35 ثانیه‌ی قبل کاربر فعالیتی نداشته‌است.
مطالب
مدیریت رخدادهای MouseLeftButtonDown و MouseLeftButtonUp در Silverlight

نیاز بود تا بتوان رخدادهای MouseLeftButtonDown و MouseLeftButtonUp یک TextBox را در Silverlight مدیریت کرد. شاید عنوان کنید که خیلی ساده است! دو روال رخداد گردان مربوطه را اضافه کنید و سپس تعاریف آن‌ها را در کدهای XAML خود قید نمائید. اما واقعیت این است که کار نمی‌کند! نه؛ کار نمی‌کند! :)

مشکل از کجاست؟ پاسخی که در MSDN در این مورد آمده است به صورت زیر می‌باشد:

"Certain control classes (for example Button) provide control-specific handling for mouse events such as MouseLeftButtonDown. The control-specific handling typically involves handling the event at a class level rather than at the instance level, and marking the MouseLeftButtonDown event data's Handled value as true such that the event cannot be handled by instances of the control class, nor by other objects anywhere further along the event route. In the case of Button, the class design does this so that the Click event can be raised instead."


به عبارتی رخداد Click زحمت کشیده و رخدادهای MouseLeftButtonDown و MouseLeftButtonUp را نیز handled معرفی می‌کند و دیگر روال رخدادگردان شما فراخوانی نخواهد شد (در WPF هم به همین صورت است) و موارد ذکر شده در visual tree یک TextBox منتشر نمی‌گردند.

راه حل چیست؟

حداقل دو راه حل وجود دارد:
الف) یک کنترل TextBox سفارشی را از کنترل TextBox اصلی باید به ارث برد و رخدادهایی را که توسط رخداد Click به صورت handled معرفی شده‌اند، unhandled کرد:

public class MyTextBox : TextBox
{
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
e.Handled = false;
}

protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
e.Handled = false;
}
}

ب) یا امکان گوش فرا دادن به رخدادهای handled نیز میسر است. فقط کافی است این گوش فرادهنده را توسط متد AddHandler که پارامتر آخر آن به true تنظیم شده است (رخدادهای handled نیز لحاظ شوند)، معرفی کرد:

public MainPage()
{
InitializeComponent();
txt1.AddHandler(FrameworkElement.MouseLeftButtonDownEvent,
new MouseButtonEventHandler(txt1_MouseLeftButtonDown), true);
}
private void txt1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{

//do something
}

اشتراک‌ها
نگارش نهایی ASP.NET Core 2.1.0 منتشر شد

Today we're thrilled to announce the release of ASP.NET Core 2.1.0! This is the latest release of our open-source and cross-platform web framework for .NET and it's now ready for production use. 

نگارش نهایی ASP.NET Core 2.1.0 منتشر شد