c# - Mvc 4 Code First with Mysql -
i want using mysql 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 have error
unable retrieve metadata 'wsdashboard.models.user'. using same dbcompiledmodel create contexts against different types of database servers not supported. instead, create separate dbcompiledmodel each type of server being used.
Comments
Post a Comment