Ich möchte in meiner Anwendung Tabelle Pro Betontyp Erbe haben:Entity Framework TPC Erbe Ausgabe
public class Row {
public int Id {get;set;}
public string Name {get;set;}
}
public class ExtendedRow : Row {
public int Weight {get;set;}
}
Jede der Klassen, um ihre eigene Sicht abgebildet werden müssen und ExtendedRow
Ansicht hat alle Spalten Ansicht.
Meine Konfiguration ist:
modelBuilder.Entity<Row>().Map(m => {
m.MapInheritedProperties();
m.ToTable("Row");
});
modelBuilder.Entity<ExtendedRow >().Map(m => {
m.MapInheritedProperties();
m.ToTable("ExtendedRow");
});
Abfragen ExtendedRow
ganz gut ist. Allerdings Abfrage generiert die folgende SQL:
SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Name] AS [Name]
FROM [dbo].[Row] AS [Extent1]
UNION ALL
SELECT
[Extent2].[Id] AS [Id],
[Extent2].[Name] AS [Name]
FROM [dbo].[ExtendedRow] AS [Extent2]
Warum fügen EF UNION ALL
Operator? Wie repariere ich es?