Question: Why the for each loop dose not show the animal in the database? System; Microsoft. EntityFraneworkCore; Microsoft. Extensions. Configuration; espace WebApplication4. Data 5 references public

 Why the for each loop dose not show the animal in

the database? System; Microsoft. EntityFraneworkCore; Microsoft. Extensions. Configuration; espace WebApplication4. Data 5

references public partial class AninalHomeContext : DbContext t 0 refterencets public AnimaLHomeContext()

f \} 0 refierences: public AnimalHomeContext(DbContextOptions options) : base(options) i \} 1

reference public virtual DbSet Animal \{ get; set; \} 0 references protected

Why the for each loop dose not show the animal in the database?

System; Microsoft. EntityFraneworkCore; Microsoft. Extensions. Configuration; espace WebApplication4. Data 5 references public partial class AninalHomeContext : DbContext t 0 refterencets public AnimaLHomeContext() f \} 0 refierences: public AnimalHomeContext(DbContextOptions options) : base(options) i \} 1 reference public virtual DbSet Animal \{ get; set; \} 0 references protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) optionsBuilder. UseSqlServer(WebApplication (CreateBuilder(). Build(). Configuration. GetConnectionString ("AnimalHone")); O references: protected override void OnHodelCreating (ModelBuilder modelBuilder) t modelBuilder. Entity(entity \{ entity. HasKey(e e.Id). HasName("PK_Animal_3214EC07420F4064"); entity. ToTable("Animal"); entity. Property(e e.Id). ValueGeneratedNever(); \}); OnModelCreatingPartial(modelBuilder); \} 1 reference partial void OnllodelCreatingPartial (HodelBuilder modelBuilder); \} sing Microsoft.AspNetCore.Mvc.RazorPages; sing WebApplication4.Data; Iamespace WebApplication4.Pages 6 references public class ShopModel : PageModel \{ private readonly AnimalHomeContext_dbContext; 0 references public ShopModel (AnimalHomeContext dbContext) \{ _dbContext = dbContext; \} 2 references public List Animals \{ get; private set; \} 0 references public void OnGet() \{ Animals = _dbContext.Animal.ToList(); \} \} using System; using System.Collections.Generic; namespace WebApplication4.Data; 3 references public partial class Animal \{ 2 references public Guid Id \{ get; set; \} 2 references public string Name { get; set; \} 1 reference public string? Description \{ get; set; \} 1 reference public string? FeaturedImageUrl \{ get; set; \} 1 reference public string? Location \{ get; set; \} \} y> @foreach (var ani in Model.Animals) \{ @ani. Name @ani.Description @ani.Location div> div > \} div> dy> ml>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!