I am trying to make Scaffold in visual studio with MVC 5 but it is giving the following error

0

I'm trying and gives the following error

The error is this 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 separate 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 am 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; }

    }
}
    
asked by anonymous 06.02.2018 / 16:29

0 answers