c# - cannot access a disposed object UserManager in asp.net mvc core -
i have following code in service should create usermanager instance
public class subscriptionservice : isubscriptionservice { private usermanager<applicationuser> usermanager; public usermanager<applicationuser> usermanager { { return usermanager; } private set { usermanager = value; } } public subscriptionservice( usermanager<applicationuser> usermanager, stripecustomerservice customerservice, stripesubscriptionservice subscriptionservice) { this.usermanager = usermanager; this.customerservice = customerservice; this.subscriptionservice = subscriptionservice; } public subscriptionservice(usermanager<applicationuser> usermanager) { this.usermanager = usermanager; }
when usermanager called first time inside class, works second call returns error "cannot access disposed object usermanager
"
i'm consuming subscriptionservice class in controller with:
public isubscriptionservice subscriptionservice { { return subscriptionservice ?? new subscriptionservice(_usermanager); } private set { subscriptionservice = value; } }
can point me i'm wrong , how fix it?
i'm using asp.net core 1.0
edit: here's user manager inspected right after first execution in function
Comments
Post a Comment