I have added an entity which resolves from a SQL query like this. This entity is owned/managed by some other DbContext
and I just use it as a data reference. No updates/deletes or DDL will be created from my app for this entity.
modelBuilder.Entity<ATableManagedBySomeElse>(entity =>
{
entity.HasKey(e => e.id);
entity.ToSqlQuery("SELECT id FROM data");
entity.Property(e => e.ContractId)
.HasColumnName("id");
});
I have marked it as [NotMapped]
declaratively as well as using fluent syntax. However, adding the migration causes the entity to be created in the migration code.
Is there another flag/command I’m supposed to use for this scenario?
1