1
I am trying to recover some data from my database but is giving the following error
Specified key was Too long; max key length is 767 bytes
I have no idea what’s going on.
User class
public class Usuario
{
[Key]
public int UsuarioId { get; set; }
public string Email { get; set; }
public string Senha { get; set; }
public DateTime DataCadastro { get; set; }
public string Nome { get; set; }
public string Sobrenome { get; set; }
public float Latitude { get; set; }
public float Longitude { get; set; }
public string Token { get; set; }
public bool Confirmado { get; set; }
public string Apelido { get; set; }
public string Imagem { get; set; }
public bool Privado { get; set; }
public string ImagemCapa { get; set; }
public DateTime DataNascimento { get; set; }
public int Sexo { get; set; }
public DateTime DataExpiracaoToken { get; set; }
public int EstiloId { get; set; }
public Estilo Estilo { get; set; }
Style Class
public class Estilo
{
[Key]
public int EstiloId { get; set; }
public string Nome { get; set; }
public string Local { get; set; }
public virtual ICollection<Usuario> Usuarios { get; set; }
Style configuration class for code-first
public EstiloConfig()
{
HasKey(a => a.EstiloId);
HasMany(a => a.Usuarios).WithRequired(a => a.Estilo).HasForeignKey(a => a.EstiloId);
Property(a => a.Nome).IsRequired().HasMaxLength(45);
Property(a => a.Local).IsRequired().HasMaxLength(100);
}
You can edit your question and post the Model? It’s an index problem.
– Leonel Sanches da Silva
Ai @Ciganomorrisonmendez ??
– Frank Dantas