Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextSeedData not working #2

Closed
arianshahalami opened this issue May 29, 2019 · 2 comments
Closed

ContextSeedData not working #2

arianshahalami opened this issue May 29, 2019 · 2 comments

Comments

@arianshahalami
Copy link

arianshahalami commented May 29, 2019

Hi there, there is a problem with FreelanceBlogContextSeedData.cs. When I launch the code, I get this error in that class :
System.ObjectDisposedException: 'Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'FreelancerBlogContext'.'

HERE IS A RELATED IMAGE
Untitled

@blagojcej
Copy link

You should add .Wait() to SeedAdminUser method in Startup->Configure and change return type of SeedAdminUser method from void to Task.
seeder.SeedAdminUser().Wait();

@HamidMosalla
Copy link
Owner

The issue is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants