Home

Is there a way to add virtual navigation properties?

I am connecting to a MSSQL database.

With my own EFCore DbContext I can tell EFCore there are foreign keys even though the foreign key constraints do not exist in the database.

I am not allowed to edit the database. So I would really like to tell my LinqPad connect that my tables have foreign keys so I can leverage navigation properties.

Comments

  • Are you aware that LINQPad lets you connect to your own EF Core DbContexts for this purpose?

  • @JoeAlbahari I think so, but doesn't that defeat the point of using LinqPad as a quick tool for interacting with an arbitrary DB in a strongly typed way? If I have to build my entire DB out in POCOs and build my own DbContext doesn't that eat a lot of the value of LinqPad? Would it be possible for Linqpad to generate partial classes so that we may provide another partial class with DataAnnotations over navigation properties?

Sign In or Register to comment.