public void QueriesOnAlternateIdentifier() { using (var context = new InheritanceContext()) { var query = context.Set <TpcRoot>().Where(x => x.AlternateIdentifiers.Any(y => y.Identifier == "SomeIdentifier")); var sql = query.ToString(); Assert.Contains("tpc_leaf1", sql); Assert.Contains("tpc_leaf2", sql); Assert.Contains("tpc_leaf3", sql); } }
public void QueriesOnIntermediateTypeIncludesChildTablesAndUp() { using (var context = new InheritanceContext()) { var query = context.Set <TpcIntermediate>().Where(x => x.Id == Guid.Empty); var sql = query.ToString(); Assert.Contains("tpc_leaf1", sql); Assert.Contains("tpc_leaf2", sql); Assert.DoesNotContain("tpc_leaf3", sql); } }
public void QueriesOnRootTypeIncludeAllTables() { using (var context = new InheritanceContext()) { var query = context.Set <TpcRoot>().Where(x => x.Id == Guid.Empty); var sql = query.ToString(); Assert.Contains("tpc_leaf1", sql); Assert.Contains("tpc_leaf2", sql); Assert.Contains("tpc_leaf3", sql); } }
public void QueriesOnLeafTypesOnlyIncludeLeafTypeTable() { using (var context = new InheritanceContext()) { var query = context.Set <TpcLeafType1>(); var sql = query.ToString(); Assert.Contains("tpc_leaf1", sql); Assert.DoesNotContain("tpc_leaf2", sql); Assert.DoesNotContain("tpc_leaf3", sql); } }
public void QueriesOnAlternateIdentifier() { using (var context = new InheritanceContext()) { var query = context.Set <TphRoot>().Where(x => x.AlternateIdentifiers.Any(y => y.Identifier == "SomeIdentifier")); var sql = query.ToString(); Assert.Contains("tph_root", sql); Assert.DoesNotContain("tph_leaf1", sql); // simply does not exist Assert.DoesNotContain("tph_leaf2", sql); // simply does not exist Assert.DoesNotContain("tph_leaf3", sql); // simply does not exist } }
public void QueriesOnRootTypeIncludeAllTables() { using (var context = new InheritanceContext()) { var query = context.Set <TphRoot>().Where(x => x.Id == Guid.Empty); var sql = query.ToString(); Assert.Contains("tph_root", sql); Assert.DoesNotContain("tph_leaf1", sql); // simply does not exist Assert.DoesNotContain("tph_leaf2", sql); // simply does not exist Assert.DoesNotContain("tph_leaf3", sql); // simply does not exist } }
public void QueriesOnLeafTypesOnlyIncludeLeafTypeTable() { using (var context = new InheritanceContext()) { var query = context.Set <TphLeafType1>(); var sql = query.ToString(); Assert.Contains("tph_root", sql); Assert.DoesNotContain("tph_leaf1", sql); // simply does not exist Assert.DoesNotContain("tph_leaf2", sql); // simply does not exist Assert.DoesNotContain("tph_leaf3", sql); // simply does not exist } }