Home
Options

Is it possible to exert any control over creation of UserQuery models for a database connection?

Given the simplistic example where my database has tables A and B and view C declared as

CREATE VIEW C AS
SELECT A.*, B.B1
FROM A INNER JOIN B ON B.AId = A.Id

when I add a connectionfor the database with pluralised table names it will reflect As, Bs and Cs in the tree and I might have access to the following models

public class A
{
  public Guid Id { get; set; }
  public int A1 { get; set; }
  public string A2 { get; set; }
}

public class B
{
  public Guid Id { get; set; }
  public Guid AId { get; set; }
  public string B1 { get; set; }
  public string B2 { get; set; }
}

public class C
{
  public Guid Id { get; set; }
  public int A1 { get; set; }
  public string A2 { get; set; }
  public string B1 { get; set; }
}

But I would prefer that the model for C inherits A as

public class C : A
{
  public string B1 { get; set; }
}

Does LINQPad allow any control over how the EF Core models for a connection are created that would enable this?

Comments

Sign In or Register to comment.