Esempio 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);
     }
 }
Esempio 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);
     }
 }
Esempio 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);
     }
 }
Esempio 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);
     }
 }
Esempio 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
     }
 }
Esempio 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
     }
 }
Esempio 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
     }
 }