1
public class Evento {
public int Id { get; set; }
public string Nome { get; set; }
public Categoria Categoria { get; set; }
public CasaShow CasaShow { get; set; }
public float QuantDeIngressos { get; set; }
public DateTime Data { get; set; }
public float ValorDoIngresso { get; set; }
public DateTime Hora { get; set; }
public bool Status { get; set; }
}
public class Venda {
public int Id { get; set;}
public IdentityUser User { get; set; }
public List<Evento> Evento { get; set;}
}
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet <Categoria> Categorias { get; set; }
public DbSet <CasaShow> CasasShows { get; set; }
public DbSet <Evento> Eventos { get; set; }
public DbSet <Venda> Vendas { get; set; }
protected override void OnModelCreating (ModelBuilder builder) {
base.OnModelCreating (builder);
builder.Entity<Venda>().HasMany(x => x.Evento);
//Change my AspNetUser table to User
builder.Entity<IdentityUser> ().ToTable ("User");
//Change my AspNetRoles to Role
builder.Entity<IdentityRole> ().ToTable ("Role");
}
}
I want a relationship of one
to
many
, where a sale receives several events, but the database does not recognize any of the forms of declaration with ICollection
, IList
, List
or in the builder With Many
.
The answer worked out for you?
– novic