Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 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
     }
 }
Exemplo n.º 6
0
 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
     }
 }
Exemplo n.º 7
0
 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
     }
 }