Base solution for your next web application
BLACK FRIDAY
From Nov 21
To Dec 1
XXDAYS : XXHRS : XXMIN : XXSEC
SAVE UP TO$3K
Also valid for the
existing customers!
Open Closed

Question about your pattern #799


0
jack created

At what point is called the AbpDbContext.Initialize() method?

    public virtual void Initialize()
    {
        Database.Initialize(false);
        this.SetFilterScopedParameterValue(AbpDataFilters.MustHaveTenant, AbpDataFilters.Parameters.TenantId, AbpSession.TenantId ?? 0);
        this.SetFilterScopedParameterValue(AbpDataFilters.MayHaveTenant, AbpDataFilters.Parameters.TenantId, AbpSession.TenantId);
    }

and why do you use Singleton rather than dependency injection? protected AbpDbContext() { Logger = NullLogger.Instance; AbpSession = NullAbpSession.Instance; EntityChangeEventHelper = NullEntityChangeEventHelper.Instance; }

why not protected AbpDbContext(ILogger,IAbpSession) ?


3 Answer(s)
  • 0
    hikalkan created
    Support Team

    Hi,

    This is not sigleton. I use dependency injection. I'm using property-injection pattern (see document: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection#DocPropertyInjection">http://www.aspnetboilerplate.com/Pages/ ... yInjection</a>)

  • 0
    jack created

    Thanks

    But when the "Initialize" method in ApbDbContext is started?

  • 0
    hikalkan created
    Support Team

    Just after it's created but before properties injected.