اشتراک‌ها
هزینه استثناء

Hopefully the era of leprosy and corona is over for this time and it’s time to get back to blogging. Exceptions are powerful feature of object-oriented languages as far as they are used like they are thought to use – throw exception only when something really unexpected happens  

هزینه استثناء
اشتراک‌ها
رکورد های سی شارپ چگونه زندگی مرا تغییر خواهد داد

Immutability comes with a lot of benefits, but sometimes it can be a bit cumbersome to deal with when you only want to update some properties. Since the object is immutable, you need to create a copy with all the existing values and the new updated one.

I will show you how Records in C# 9 will greatly simplify this

رکورد های سی شارپ چگونه زندگی مرا تغییر خواهد داد
اشتراک‌ها
Entity Framework Core 6.0 Preview 2 منتشر شد

Today, the Entity Framework Core team announces the second preview release of EF Core 6.0. This release includes changes to handling the synchronization context when SaveChangesAsync is called, smoother integration with System.Linq.Async, updates to string concatenation and improvements to free text search. 

Entity Framework Core 6.0 Preview 2 منتشر شد
اشتراک‌ها
معرفی EfCore.InMemoryHelpers

• Add foreign key constraint checking to the in-memory provider
Reasoning: It is desirable for foreign keys to be validated when running unit tests. This allows bugs to be caught earlier without the need for integration testing against a real database.

معرفی EfCore.InMemoryHelpers
اشتراک‌ها
خودکارسازی فرآیند اعمال GlobalQueryFilter در EF Core

Entity Framework Core 2.0 introduces global query filters that can be applied to entities when a model is created. It makes it easier to build multi-tenant applications and support soft deleting of entities. This blog post gives a deeper overview of how to use global query filters in real-life applications and how to apply global query filters to domain entities automatically. 

خودکارسازی فرآیند اعمال GlobalQueryFilter در EF Core
اشتراک‌ها
نگارش بعدی ASP.NET Core از Full .NET Framework پشتیبانی نمی‌کند

Last Friday, ASP.NET Core quietly switched from supporting .NET Standard 1.* and .NET 4.* to only supporting .NET Core 2.0. This means that ASP.NET Core 1.0/1.1 applications running Mono or the full .NET Framework will not be upgradable to ASP.NET Core 2.0 when it is released in 2-3 months. 

نگارش بعدی ASP.NET Core از Full .NET Framework پشتیبانی نمی‌کند
نظرات مطالب
ASP.NET MVC #17

عنوان خطا: The anti-forgery token could not be decrypted

جزئیات خطا

The anti-forgery token could not be decrypted. 
If this application is hosted by a Web Farm or cluster,
ensure that all machines are running the same version of ASP.NET Web Pages and
that the <machineKey> configuration specifies explicit encryption and validation keys. 
AutoGenerate cannot be used in a cluster

Description: An unhandled exception occurred during the execution of the current web request. 
Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Mvc.HttpAntiForgeryException: 
The anti-forgery token could not be decrypted.
If this application is hosted by a Web Farm or cluster, 
ensure that all machines are running the same version of ASP.NET Web Pages and that the <machineKey> configuration 
specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.
شرایط  برنامه:  در زمان ذخیره سازی اطلاعات.(در Mvc دات نت فریم ورک 4.5 و Vs2013)

موارد مشابه در سایر انجمن‌ها : اینجا و اینجا و ...

نتیجه حاصله: درج MachinKey در WebConfig برای مثال:

<system.web>
  <machineKey validationKey="mykey" decryptionKey="myotherkey" validation="SHA1" decryption="AES" />
</system.web>
سوال: علت بروز خطا بر روی بعضی از سیستم‌ها چیست؟ چرا همیشه این خطا نمایش داده نمی‌شود. چرا پیغام نمی‌توانم Decrypt کنم؟ پس چرا در همین برنامه ولی دربخش دیگری که از anti-forgery token استفاده شده مشکل وجود ندارد؟
اشتراک‌ها
2.Visual Studio 2017 15.6 منتشر شد

These are the customer-reported issues addressed in this release:

Microsoft Security Advisories for .NET Core

CVE-2018-0875: Microsoft is aware of a security vulnerability in the public versions of .NET Core where a malicious file or web request could cause a denial of service (DoS) attack.

  • System administrators are advised to update their .NET Core runtimes to versions 1.0.10, 1.1.7 or 2.0.6. Developers are advised to update their .NET Core SDK to versions 1.1.8 or 2.1.101. 

حجم تقریبی بروزرسانی از نسخه 15.6.1 به 15.6.2 برابر 1.2GB می‌باشد

2.Visual Studio 2017 15.6 منتشر شد
اشتراک‌ها
تزریق وابستگی‌ها با طول عمر Tenant-Singleton

The missing scope - Tenant-Singleton

If a singleton is created once per application, you can probably guess that a tenant-singleton is created once per tenant.

So when might you need this scope? Think of any object that is expensive to create or needs to maintain state yet should be isolated for each tenant. Good examples would be NHibernate's Session Factory, RavenDB's Document Store or ASP.NET's Memory Cache. 

تزریق وابستگی‌ها با طول عمر Tenant-Singleton