How would I covert this query to inline sql or a stored procedure?
var a = from arow in context.post
where arow.post_id == id && arow.post_isdeleted == false
select new
{
arow.post_id,
PostComments = from c in context.comment
where c.CommentPostID == arow.post_id
select new
{
c.id,
c.title
}
}
List<PostType> pt;
foreach (var s in a)
{
pt = new PostType();
pt.PostID = s.post_id;
//how would I use ADO.NET to put this in a custom class?
foreach(var ctl in s.PostComments)
{
ctl.Title = ctl.title;
pt.CommentT.Add(ctl);
}
ptl.Add(pt);
}
Once the inline query has been executed how would I put the information in a custom class? PostComments is a subquery -- so how would I use ADO.NET to put it in a custom class?