MySQL data provider does not appear in entity data model

I am creating an MVC application with MySQL as a backend. I plan to use the Entity Framework to work with this database. I already have a database, so you need to create models from the database

Environment:

MySQL Server 5.7.21 MySQL for Visual Studio 1.27 Connector / NET 6.10.5 Visual Studio 2015

Reproduction of a problem:

Step 1: Add a new element 'Ado.net Entity Data Model' Step 2. Select “EF Designer from the database” and click “Next”. Step 3: Click "New Connection"

Missing mysql connector.

Other information:

  • I already added "System.Runtime", because an error appears when installing Mysql. data. Ef6 from Nugget
  • In the "System" I changed "CopyLocal = true". Data Link '
  • I tried the same steps in Visual Studio 2017. Here I see the provider in step 3, but after clicking ok, the dialog is closed and will not show a list of tables.

In Visual Studio 2015 and 17 start time, it shows a provider. when I tried the next time when he didn’t show Please help. I check it for 2 days

+6
source share
3 answers

To get started with VS 2013 and EF 6

  • Install MySQL for Visual Studio 1.1.1
  • Install Connector / Net 6.8.1.
  • To work with the database, first do the following:
    • , MySql.Data.Entity.EF6, .
    • /- Entity Framework :  
    • , .
  • , ,
    • , MySql.Data.Entity.EF6, .
    • ADO.Net Entity Model .
    • T4, MySQL (SSDLToMySQL)
    • , "" Script . ( MySQL Script).

, .

MySQL Visual Studio 1.1.1

MySQL Connector/Net 6.8.1 Beta

+1

MaDOS, mySql . EF , .

EF, db.

db-

public class MySqlDbContext : DbContext
{
    public DbSet<MyOrderClass> Orders { get; set; }

    public MySqlDbContext(IDbConnection connection)
        : base((DbConnection)connection, false)
    {
        Database.SetInitializer<MySqlDbContext>(null); // Disable db-changes by dbContext
    }
}

- . MS- ( Oracle DateTime). - "" - , . .Net- "" -properties, .

-

[Table("TORDERS")]
public class MyOrderClass
{
    [Column("ORDERID")]
    public long Id { get; set; }
    [Column("CREATED")]
    public string CreatedString { get; set; }

    [NotMapped]
    public DateTime? Created
    {
        get
        {
            DateTime tmp;
            if (DateTime.TryParse(this.CreatedString, out tmp))
                return tmp;

            return null;
        }
        set
        {
            this.CreatedString = value.HasValue ? value.Value.ToString("yyyy-MM-dd HH:mm:ss") : null;
        }
    }
}


    static void Main(params string[] args)
    {
        MyOrderClass tmp = new MyOrderClass() { CreatedString = "2018-01-01 11:11:11"};

        Console.WriteLine(tmp.Created.ToString()); // This is how you want to work
        tmp.Created = null;
        Console.WriteLine(tmp.CreatedString); // this is surely not what you want to do

        tmp.Created = new DateTime(2018,02,02,10,10,10);
        Console.WriteLine(tmp.CreatedString); // Check if setter works ;)
    }

Im , , EF. db, db-, - , ;).

0

Could this be a 32-bit or 64-bit problem?
Example: 64-bit Visual studio 32bit driver installed?
 I have this problem all the time with oledb for Informix. your software will work fine on a 64-bit basis, but the snap-in is 32bit.

0
source

All Articles