Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

Inheritance with Entity Framework (no replies)

$
0
0
I'm trying to use MySQL's .NET Connector with Entity Framework, but I'm getting an error:

"Schema specified is not valid. Errors:
(11,6) : error 0064: Facet 'MaxLength' must not be specified for type 'mediumtext'."

This happens whenever I want to use class inheritance with my POCO classes. I've posted a complete example of my tests after the break. If I was using SQL Server to achieve this, EF4.1 would automatically create a column called "Discriminator" on my table to control the entries. I guess there's something about the way MySQL interacts with this feature that is broken.

This post is kind of cross-posted from http://stackoverflow.com/q/8700497/891772.

Thanks in advance!

---------------------------------------

Example:

public abstract class Vehicle
{
public int Id { get; set; }
public int Year { get; set; }
}

public class Car : Vehicle
{
public string CarProperty { get; set; }
}

public class Bike : Vehicle
{
public string BikeProperty { get; set; }
}

public class Db : DbContext
{
public DbSet<Vehicle> Vehicles { get; set; }
public DbSet<Car> Cars { get; set; }
public DbSet<Bike> Bikes { get; set; }
}

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>