3
I’m taking the Entity Framework to learn, but when I run my code, it returns the following error:
System.Typeloadexception: 'Inheritance security rules were violated by type: 'Mysql.Data.Entity.Mysqlefconfiguration'. Types should correspond to the safety accessibility of the type of base 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 could be going on? How to fix?
Any way you can look for string
MySqlEFConfiguration
within the web.config?– Jéf Bueno