0

I am learning asp.net identity. I found out this nuget package from this link. It is link of sample releases, though in alpha version and not meant for actual use, i was curious for learning perspective. So installed it and really liked it (from here). Now from in empty MVC project with ASP.NET identity, using this link, i can use MySql as a storage provider.Now the question is how do i use mysql with identity samples?

3
  • You need to have the identity tables created and the correct connectionstring in web.config. Commented Oct 21, 2016 at 11:54
  • Actually identity in "empty" project is working fine. When i install identity samples (it is awesome...), it overwrites my changes and starts using localdb. Commented Oct 21, 2016 at 12:02
  • Follow the instructions for installing the Mysql entity framework provider on the Mysql website. Commented Oct 21, 2016 at 12:04

1 Answer 1

1

You need to change the connection string. By default the identity model uses the default connection string that is on the web.config. If the database doesn't exist it will create it along with the tables. You need to add mysql to visual studio first you can find this on mysql page. then create a connection to mysql then specify this by replacing the DefaultConnection"

located on the IdentityModel.cs

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.