1

I want to using mysql with asp.net mvc 4. Added reference.

  • Mysql.Data.dll
  • Mysql.Data.Entity.dll
  • Mysql.Web.dll

Added web.config file in connection string.

<add name="DBEntities" connectionString="Server=localhost; port=3306; Database=dbprojectname; Uid=root; Pwd=;" providerName="MySql.Data.MySqlClient" />

Added Model

  public class User
{
    [Key]
    public int user_id { get; set; }
    public string username { get; set; }
    public string password { get; set; }
    public string url { get; set; }
    public string name { get; set; }
    public string surname { get; set; }
    public string email { get; set; }
    public string avatar { get; set; }
    public string rank { get; set; }
    public string status { get; set; }
    public DateTime date { get; set; }
}
 public class DbEntities : DbContext
 {
     public DbSet<User> User { get; set; }
 }

and create controller but i have a error

Unable to retrieve metadata for 'WSDashboard.Models.User'. Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used.

3

1 Answer 1

0

Man, it's duplicated, but the answer is here by Yurko: https://stackoverflow.com/a/25640707/3902210

enter image description here

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.