dotConnect EFCore: Unknown method useMySql()

dotConnect EFCore: Unknown method useMySql()

Postby psobbunse » Fri 05 Aug 2016 07:49

Hi there,

I followed the example in this blog post http://blog.devart.com/entity-framework-core-1-entity-framework-7-support.html to experiment with ASP.NET Core, EntityFramework Core and dotConnect for MySql.

Now I run into the problem that the registration method UseMySql() is not defined. The assemblies are added (by a self-created nuget package) and I do not get an error on the using Devart.[...]; lines.

Here is my MyDbContext.cs:
Code: Select all
using Microsoft.Data.Entity;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Devart.Data;
using Devart.Data.MySql;
using TodoApi.Entities;

namespace TodoApi
{
   
    public class MyDbContext : DbContext
    {
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {

            // optionsBuilder.UseOracle(@"user id=user; password=password; server=ORCL1210;");
            optionsBuilder.UseMySql(@"user id=core_test; password=core_test; host=localhost; port=3307; database=core_test");
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

            modelBuilder.Entity<OrderDetail>()
              .HasKey(p => new { p.OrderID, p.ProductID });
        }

        public DbSet<Product> Products { get; set; }
        public DbSet<ProductCategory> ProductCategories { get; set; }
        public DbSet<OrderDetail> OrderDetails { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<Company> Companies { get; set; }
        public DbSet<PersonContact> PersonContacts { get; set; }
    }
   
}


Can anyone help me?
psobbunse
 
Posts: 2
Joined: Fri 05 Aug 2016 05:45

Re: dotConnect EFCore: Unknown method useMySql()

Postby Shalex » Fri 05 Aug 2016 14:58

UseMySql() is an extension method, it is available after adding the Microsoft.EntityFrameworkCore namespace in the beginning of your *.cs:
Code: Select all
using Microsoft.EntityFrameworkCore;
Shalex
Devart Team
 
Posts: 7698
Joined: Thu 14 Aug 2008 12:44

Re: dotConnect EFCore: Unknown method useMySql()

Postby psobbunse » Tue 09 Aug 2016 12:49

Thank you for your response. I realized that I had the preview version of EntitiFramework Core installed and not the 1.0.0 release version.

Now that part works fine. The next problem cannot be solved by now. I overread the part about the *full* .net framework dependency. So I cannot make dotConnect work with asp.net core only right now. I will stay tuned to see what will come.

Thank you for the support!
psobbunse
 
Posts: 2
Joined: Fri 05 Aug 2016 05:45


Return to dotConnect for MySQL