Welcome to The Xamarin Show Snack Pack Edition. A Snack Pack is bite sized episode that is focused on a specific topic and covered in just a few minutes. Today, we take a look at how to manage and upgrade your Xamarin and Xamarin.Forms based applications to target .NET Standard. We also see how to install existing PCL based NuGets into that library.
چرا SQL در حال شکست NoSQL است؟
SQL is back. Not just because writing glue code to kludge together NoSQL tools is annoying. Not just because retraining workforces to learn a myriad of new languages is hard. Not just because standards can be a good thing.
But also because the world is filled with data. It surrounds us, binds us. At first, we relied on our human senses and sensory nervous systems to process it. Now our software and hardware systems are also getting smart enough to help us. And as we collect more and more data to make better sense of our world, the complexity of our systems to store, process, analyze, and visualize that data will only continue to grow as well.
Today, we are launching .NET Live TV, your one stop shop for all .NET and Visual Studio live streams across Twitch and YouTube. We are always looking for new ways to bring great content to the developer community and innovate in ways to interact with you in real-time. Live streaming gives us the opportunity to deliver more content where everyone can ask questions and interact with the product teams.
ASP.NET Core Identity 1.1 چگونه پیامهای خطای خود را تامین میکند؟
نگارش 1.1 این فریم ورک به همراه یک فایل Resources.resx است که تمام پیامهای خطاهای ارائه شدهی توسط متدهای مختلف آنرا به همراه دارد. این فایل توسط کلاس IdentityErrorDescriber به نحو ذیل استفاده میشود:
public class IdentityErrorDescriber { public virtual IdentityError DefaultError() { return new IdentityError { Code = nameof(DefaultError), Description = Resources.DefaultError }; }
سپس کلاس IdentityErrorDescriber به سیستم تزریق وابستگیهای آن اضافه شده و هرجائیکه نیاز به نمایش پیامی را داشته، از آن استفاده میکند.
بنابراین همانطور که ملاحظه میکنید کلاس Resources آن ثابت است و قابل تغییر نیست. به همین جهت اگر معادل فارسی این فایل را تهیه کنیم، توسط این فریم ورک به صورت خودکار استفاده نخواهد شد.
فارسی سازی IdentityErrorDescriber
بهترین راه فارسی سازی کلاس IdentityErrorDescriber، ارث بری از آن و بازنویسی متدهای virtual آن است که اینکار در کلاس CustomIdentityErrorDescriber انجام شدهاست:
public class CustomIdentityErrorDescriber : IdentityErrorDescriber { public override IdentityError DefaultError() { return new IdentityError { Code = nameof(DefaultError), Description = "خطایی رخ دادهاست." }; }
services.AddScoped<IdentityErrorDescriber, CustomIdentityErrorDescriber>(); services.AddIdentity<User, Role>(identityOptions => { }).AddUserStore<ApplicationUserStore>() // the rest of the setting … .AddErrorDescriber<CustomIdentityErrorDescriber>() // the rest of the setting …
به این ترتیب این فریم ورک هرزمانیکه نیاز به وهلهای از نوع IdentityErrorDescriber را داشته باشد، از وهلهی فارسی سازی شدهی ما استفاده میکند.
مشکل! هنوز پس از جایگزینی سرویس IdentityServicesRegistry اصلی، تعدادی از خطاها فارسی نیستند!
اگر به کلاس PasswordValidator آن مراجعه کنید، در سازندهی کلاس یک چنین تعریفی را میتوان مشاهده کرد:
public class PasswordValidator<TUser> : IPasswordValidator<TUser> where TUser : class { public PasswordValidator(IdentityErrorDescriber errors = null) { Describer = errors ?? new IdentityErrorDescriber(); }
public class CustomPasswordValidator : PasswordValidator<User> { private readonly IUsedPasswordsService _usedPasswordsService; private readonly ISet<string> _passwordsBanList; public CustomPasswordValidator( IdentityErrorDescriber errors,// How to use CustomIdentityErrorDescriber IOptionsSnapshot<SiteSettings> configurationRoot, IUsedPasswordsService usedPasswordsService) : base(errors) public class CustomUserValidator : UserValidator<User> { private readonly ISet<string> _emailsBanList; public CustomUserValidator( IdentityErrorDescriber errors,// How to use CustomIdentityErrorDescriber IOptionsSnapshot<SiteSettings> configurationRoot ) : base(errors)
یک نکته: اگر کلاسهای زیر را سفارشی سازی کردید، تمامشان از حالت ()errors ?? new IdentityErrorDescriber در سازندهی کلاس خود استفاده میکنند. بنابراین ذکر مجدد و بازنویسی سازندهی آنها را فراموش نکنید (در حد ذکر مجدد سازندهی کلاس پایه کفایت میکند و مابقی آن توسط سیستم تزریق وابستگیها مدیریت خواهد شد):
- PasswordValidator
- RoleManager
- RoleStore
- UserStore
- UserValidator
- RoleValidator
کدهای کامل این سری را در مخزن کد DNT Identity میتوانید ملاحظه کنید.
PostgreSQL 17 منتشر شد
- Overhauled memory management for vacuuming, resulting in significantly lower memory usage and running time. More on this here.
- Incremental backup support.
- Faster B-tree index scans.
- MERGE enhancements, including view support.
- New functions to extract elements from UUIDs.
- WAL improvements – up to 2x write throughput on some workloads.
- Improvements to SQL/JSON support, including JSON_TABLE.
- Bulk loading improvements and perf improvements for COPY which gains the ON_ERROR ignore option to ignore errors.
- Identity columns on partitioned tables.