0
I’m trying and makes the following mistake
This is the mistake There was an error running the Selected code Generator: 'Unable to Retrieve Metadata for 'iceguara.Models.Member'. Using the same Dbcompilemodel to create contexts Against Different types of database Servers is not supported. Instead, create a separaete dbCompileModel for each type of server being used.
The context is like this
using MySql.Data.Entity;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;
namespace iceguara.Models
{
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class Context : DbContext
{
public Context() : base("iceguara")
{
Configuration.ProxyCreationEnabled = false;
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<Context>());
}
public DbSet<Estado> Estados { get; set; }
//public DbSet<Membro> Membros { get; set; } (Herança de pessoa)
public DbSet<Pessoa> Pessoas { get; set; }
//public DbSet<Transporte> Transportes { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove();
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
}
}
}
The class I’m trying to do is this : MEMBER
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace iceguara.Models
{
public class Membro:Pessoa
{
[Required(ErrorMessage = "Preencha o CPF")]
[DisplayName("CPF")]
[StringLength(14, MinimumLength = 14, ErrorMessage = "CPF deve ter 14 caracteres.")]
public string CPF { get; set; }
[Required(ErrorMessage = "Preencha o telefone")]
[DisplayName("Telefone")]
[StringLength(13, MinimumLength = 13, ErrorMessage = "O telefone deve ter 13 caracteres.")]
public string Telefone { get; set; }
[Required(ErrorMessage = "Preencha o celular")]
[DisplayName("Celular")]
[StringLength(14, MinimumLength = 14, ErrorMessage = "O celular deve ter 14 caracteres.")]
public string Celular { get; set; }
[Required(ErrorMessage = "Preencha a Rua")]
[DisplayName("Rua")]
[StringLength(14, MinimumLength = 14, ErrorMessage = "O celular deve ter 14 caracteres.")]
public string Rua { get; set; }
[Required(ErrorMessage = "Preencha o Bairro")]
[DisplayName("Bairro")]
[StringLength(14, MinimumLength = 14, ErrorMessage = "O celular deve ter 14 caracteres.")]
public string Bairro { get; set; }
[Required(ErrorMessage = "Preencha Numero da sua casa")]
[DisplayName("Numero Casa")]
[StringLength(14, MinimumLength = 14, ErrorMessage = "O celular deve ter 14 caracteres.")]
public string NumeroCasa { get; set; }
}
}
Please post the error text-based instead of using image
– Jéf Bueno
put, sorry, I thought the print would be easier
– Gabriel Bonifácio