modelBuilder.Entity<RoomType>()
.HasData(
new RoomType()
{
Id = 1,
Title = "Single Room",
Description = "A single room has one single bed for single occupancy. An additional bed (called an extra bed) may be added to this room at the request of a guest and charged accordingly.",
ImgUrl = "https://webbox.imgix.net/images/owvecfmxulwbfvxm/c56a0c0d-8454-431a-9b3e-f420c72e82e3.jpg?auto=format,compress&fit=crop&crop=entropy",
Amenities = Amenities.Where(x => x.Id == 1 && x.Id == 2).ToList()
},
Amenities and RoomType have a many to many relationship. I have a table called AmenitiesRoomType to facilitate the relationship.
But when I try to seed data in OnModelCreating, I cannot update database.
I get the error:
An attempt was made to use the model while it was being created. A DbContext instance cannot be used inside 'OnModelCreating' in any way that makes use of the model that is being created.