I'm getting the Entity Framework to learn, but when I run my code, it returns the following error:
System.TypeLoadException: 'Inheritance security rules have been violated by the type: 'MySql.Data.Entity.MySqlEFConfiguration'. The types must correspond to security accessibility of the type basis or be less accessible
Error line:
EntityContext contexto = new EntityContext();
EntityContext class:
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class EntityContext : DbContext
{
public EntityContext() : base("MyContext")
{
}
public DbSet<Usuario> Usuarios { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Usuario>();
}
}
App.Config:
<connectionStrings>
<add name="MyContext" providerName="MySql.Data.MySqlClient"
connectionString="server=localhost;database=teste;uid=root;password="/>
</connectionStrings>
What can be happening? How to fix?