I followed the example in this blog post http://blog.devart.com/entity-framework ... pport.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; }
}
}