در نگارشهای اخیر داتنت، NET CLI. به همراه تغییرات قابل توجهی بودهاست که در این مطلب و نظرات آن، موارد مهم این تغییرات را بررسی خواهیم کرد.
console logger بهبود یافتهی داتنت 8
یکی از تغییرات بسیار جالب توجه و مفید NET CLI. در داتنت 8، امکان دسترسی به خروجی لاگهای ساختار یافتهی اعمال خط فرمان آن است:
اگر پروژهی خود را با استفاده از دستور dotnet build، کامپایل میکنید، خروجی پیشفرض این دستور خط فرمان، کلی و بدون ارائهی جزئیات است؛ اما میتوان آنرا در داتنت 8، به شکل تصویر فوق، تغییر داد و به این مزایا رسید:
- امکان مشاهدهی زمان کامپایل هر قسمت به صورت جداگانه
- امکان مشاهدهی پویای درصد انجام عملیات
- امکان مشاهدهی جزئیات کامپایل هر target framework به صورت مجزا
- دسترسی به یک خروجی رنگی و زیباتر
این خروجی را که به صورت پیشفرض فعال نیست، میتوان به دو صورت:
الف) سراسری و با اجرای دستور PowerShell زیر:
[Environment]::SetEnvironmentVariable("MSBUILDTERMINALLOGGER", "auto", "User")
که متغیر محیطی MSBUILDTERMINALLOGGER را به auto تنظیم میکند،
ب) و یا با استفاده از سوئیچ tl-- به ازای هر دستور dotnet build، به صورت جداگانهای فعال کرد:
dotnet build --tl
یک نکته: این قابلیت جالب و مهم، در دات نت 9، به صورت پیشفرض فعال است و نیازی به تنظیم خاصی ندارد.
Here’s what’s new in this preview release:
- Smaller SignalR, Blazor Server, and MessagePack scripts
- Enable Redis profiling sessions
- HTTP/3 endpoint TLS configuration
- Initial .NET Hot Reload support
- Razor compiler no longer produces a separate Views assembly
- Shadow-copying in IIS
- Vcpkg port for SignalR C++ client
- Reduced memory footprint for idle TLS connections
- Remove slabs from the
SlabMemoryPool
-
BlazorWebView
controls for WPF & Windows Forms
استفاده از MVVM در ASP.NET Core
Open source MVVM framework for ASP.NET Core and OWIN
View
@viewModel DotvvmDemo.CalculatorViewModel, Dotvvm <p> Enter the first number: <dot:TextBox Text="{value: Number1}" /> </p> <p> Enter the second number: <dot:TextBox Text="{value: Number2}" /> </p> <p> <dot:Button Text="Calculate" Click="{command: Calculate()}" /> </p> <p> The result is: {{value: Result}} </p>
ViewModel
using System; namespace DotvvmDemo { public class CalculatorViewModel { public int Number1 { get; set; } public int Number2 { get; set; } public int Result { get; set; } public void Calculate() { Result = Number1 + Number2; } } }
Automapper به بنیاد NET. پیوست.
AutoMapper has been a popular library in the .NET open source community for a long time. As their site says:
AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us?
Here’s a summary of what’s new in this preview release:
- Support for route handler filters in minimal APIs
- Improved unit testability for minimal route handlers
- Bind using
TryParse
in MVC and API controllers - New
Results.Stream()
overloads - Improved HTTP/2 performance when using many streams on a connection
- New
ServerReady
event for measuring startup time - Developer exception page dark mode
NET 5.0 Preview 2. منتشر شد
Today, we’re releasing .NET 5.0 Preview 2. It contains a set of smaller features and performance improvements. We’re continuing to work on the bigger features that will define the 5.0 release, some of which are starting to show up as initial designs at dotnet/designs.
In this video, I show ten extremely useful Visual Studio features: - Enhanced Clipboard - Run To Cursor Debugging - Tracking Active Solution Explorer Item - Fast File Navigation - Tabs - Previewing and Pinning - Code Cleanup Configuration - Vertical Selection - Better Git Pull - Improved Performance On Load - Special Pasting