تزریق وابستگی‌ها با طول عمر Tenant-Singleton
200, OK
https://michael-mckenna.com/multi-tenant-asp-dot-net-core-application-tenant-containers icon

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
Lazy Loading و مزایای استفاده از آن در بخش Write سیستم
200, OK
https://enterprisecraftsmanship.com/2018/09/10/defense-lazy-loading/ icon

In Defense of Lazy Loading

I don’t know how this happened but for the last couple years (at least), whenever I read an author who writes about ORMs, I often see a sentiment like this: “ORMs are fine, just make sure you disable this pesky feature called Lazy Loading”.

It’s like this feature is not even needed and only brings confusion and performance issues to everyone who chooses to use it. Well, as you may guess from the title of this article, I disagree with this point of view completely. 

Lazy Loading و مزایای استفاده از آن در بخش Write سیستم
اعتبارسنجی Domain Model‎
301, MovedPermanently
http://www.kamilgrzybek.com/design/domain-model-validation/ icon

BC scope validation implementation 

public interface ICustomerUniquenessChecker
{
    bool IsUnique(Customer customer);
}
public Customer(string email, string name, ICustomerUniquenessChecker customerUniquenessChecker)
{
    this.Email = email;
    this.Name = name;

    var isUnique = customerUniquenessChecker.IsUnique(this);
    if (!isUnique)
    {
        throw new BusinessRuleValidationException("Customer with this email already exists.");
    }

    this.AddDomainEvent(new CustomerRegisteredEvent(this));
}


اعتبارسنجی Domain Model‎
روش‌های مقابله با مشکل امنیتی Mass Assignment در ASP.NET Core
200, OK
https://andrewlock.net/preventing-mass-assignment-or-over-posting-in-asp-net-core/ icon
  • Use BindAttribute on the action method 
  • Use [Editable] or [BindNever] on the model 
  • Use two different models 
  • Use a base class 
  • Use ModelMetadataTypeAttribute 
  • Explicit binding via TryUpdateModelAsync<> 

This was a very quick run down of some of the options available to you to prevent mass assignment. Which approach you take is up to you, though I would definitely suggest using one of the latter 2-model approaches. There are other options too, such as doing explicit binding via TryUpdateModelAsync<> but the options I've shown represent some of the most common approaches. Whatever you do, don't just blindly bind your view models if you have properties that should not be edited by a user, or you could be in for a nasty surprise.

And whatever you do, don't bind directly to your EntityFramework models. Pretty please. 

روش‌های مقابله با مشکل امنیتی Mass Assignment در ASP.NET Core
مقایسه‌ای کوتاه بین ABP Framework و DNTFrameworkCore
200, OK
https://medium.com/@rabbal/dntframeworkcore-vs-abp-framework-b48f5b7f8a24 icon

In this post, I want to compare “DNTFrameworkCore” with “ABP Framework”.


ABP is one of most popular and well documented frameworks with high level abstraction that I learned a lot from it. It has many other features that I don’t list them in this post, because, DNTFrameworkCore has not them actually. Behind of ABP, there is a team. It has 123 contributors in GitHub. Also, all of features have related unit-tests.

In other side, DNTFrameworkCore is lightweight with low level abstraction. It is personal open-source project without any contributor and has unit-tests for small part. 

I wrote this post to prove that thinking behind of DNTFrameworkCore completely different from ABP (at least in most sections)  

مقایسه‌ای کوتاه بین ABP Framework و DNTFrameworkCore