Unrecognized attribute 'name' error when running linq command

后端 未结 3 1435
萌比男神i
萌比男神i 2021-01-15 04:21

I am using Entity Framework 6 in my APS.NET 4.5 web application.

When running the following command:

using (var db = new booksEnteties())
{
    var          


        
3条回答
  •  悲哀的现实
    2021-01-15 04:57

    Just adding a summary of versions

    • For EF4, use Connector/NET 6.6.x (current GA is 6.6.6)
    • For EF5, use Connector/NET 6.7.x (current GA is 6.7.4) or Connector/NET 6.8.x (current GA is 6.8.3).
    • For EF6, use Connector/NET 6.8.x (current GA is 6.8.3).

    in EF5 or less, all ok. in EF6, you need to use mysql connector 6.8.x, and add DbConfigurationTypeAttribute to you DbContext:

    [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
    public class DemoContext : DbContext{}
    

    which MySqlEFConfiguration is in MySql.Data.Entity.EF6.dll in 6.8.x. Have a try!

提交回复
热议问题