kavya m

kavya m

  • NA
  • 139
  • 21.2k

asp.net core code first

Apr 23 2023 6:30 AM

I need to call 3 diferents views from my db context, but 3 views return sameview model.so how to declare 3 views and retund types in context class and onmodel builder creating.

 public virtual DbSet<VwM> View1 { get; set; }
        public virtual DbSet<VwM> View2 { get; set; }
        public virtual DbSet<VwM> View3{ get; set; }


 modelBuilder.Entity<VwM>().ToView($"{nameof(this.View1 )}");
            modelBuilder.Entity<VwM>().ToView($"{nameof(this.View2 )}");
           modelBuilder.Entity<VwM>().ToView($"{nameof(this.View3)}");  this code didnt work


Answers (4)