using System.Collections.Generic;
public static void Main()
DataContext dc = new DataContext();
var finding = dc.Findings.First(x=>x.FindingId == new Guid("9deff1ed-4a0b-a687-452c-144f3c10ef88"));
Console.WriteLine("First comment on finding is: " + finding.Comments.First().Text);
Console.WriteLine("Second comment on finding is: " + finding.Comments.Skip(1).First().Text);
Console.WriteLine("Last comment on finding is: " + finding.Comments.Last().Text);
public IQueryable<Finding> Findings {
Console.WriteLine("QUERY: DC Findings");
return _Findings.AsQueryable();
private List<Finding> _Findings => new List<Finding> { new Finding(this) { FindingId = new Guid("9deff1ed-4a0b-a687-452c-144f3c10ef88") } };
public IQueryable<Comment> Comments {
Console.WriteLine("QUERY: DC Comments");
return _Comments.AsQueryable();
private List<Comment> _Comments => new List<Comment> {
new Comment { Text = "A", AttachedToObjectId = new Guid("9deff1ed-4a0b-a687-452c-144f3c10ef88") },
new Comment { Text = "B", AttachedToObjectId = new Guid("9deff1ed-4a0b-a687-452c-144f3c10ef88") },
new Comment { Text = "Q", AttachedToObjectId = new Guid() },
new Comment { Text = "R", AttachedToObjectId = new Guid() },
new Comment { Text = "Z", AttachedToObjectId = new Guid("9deff1ed-4a0b-a687-452c-144f3c10ef88") }
DataContext DataContext { get; }
public Finding(DataContext dc)
public List<Comment> Comments {
return DataContext.Comments.Where(x => x.AttachedToObjectId == this.FindingId).ToList();
public Guid FindingId { get; set; }
public string Text { get; set; }
public Guid AttachedToObjectId { get; set; }