I'm trying to create a Razor List View using the model and the context of an SQL View I succesfully scaffolded before as it was a Table. When trying to scaffold the controller I get the 'Primary key not found' error message.
Model:
using System;
namespace PSWebase2.Models
{
public partial class ViewCalibraRmm
{
public string CódigoDoRmm { get; set; }
public DateTime? DataUc { get; set; }
public DateTime? DataPc { get; set; }
}
}
Context already has the "HasNoKey" in its properties:
protected override void OnModelCreating(ModelBuilder modelBuilder) {
modelBuilder.Entity < ViewCalibraRmm > (entity => {
entity.HasNoKey();
entity.ToView("View_Calibra_RMM");
entity.Property(e => e.CódigoDoRmm)
.HasColumnName("Código_do_RMM")
.HasMaxLength(66);
entity.Property(e => e.DataPc)
.HasColumnName("DataPC")
.HasColumnType("datetime");
entity.Property(e => e.DataUc)
.HasColumnName("DAtaUC")
.HasColumnType("datetime");
});

