0

Estou tentando e dá o seguinte erro inserir a descrição da imagem aqui

O Erro é esse There was an error running the selected code generator: 'Unable to retrieve metadata for 'iceguara.Models.Membro''. Using the same DbCompileModel to create contexts against different types of database servers is not supported. Instead, create a separete dbCompileModel for each type of server being used.

O context está assim

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>();
        }


    }
}

A classe que estou tentando fazer é essa : MEMBRO

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; }

    }
}
2
  • 1
    Por favor, poste o erro em texto ao invés de usar imagem
    – Jéf Bueno
    6/02/2018 às 15:35
  • coloquei, desculpe, achei que o print seria mais fácil 6/02/2018 às 18:56

0

Você deve fazer log-in para responder a esta pergunta.

Pesquise outras perguntas com a tag .