Base solution for your next web application
Open Closed

Question about your pattern #799


User avatar
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)
  • User Avatar
    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>)

  • User Avatar
    0
    jack created

    Thanks

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

  • User Avatar
    0
    hikalkan created
    Support Team

    Just after it's created but before properties injected.