La potenza è nulla senza controllo

“questa è classe, coglionazzo!” (cit.) o “si salvi chi può” (cit.)?

public class DiscussionGroupDto
{
    public int Id;
    public string Description;
    public string Name;
    public int NumberOfPosts;
    public int NumberOfThreads;
    public DiscussionMessageDto LastMessage;
}

public class DiscussionMessageDto
{
    public int Id;
    public string AuthorName;
    public DateTime DateOfPublishing;
    public string Subject;
    public int ThreadId;
}

IList<DiscussionGroupDto> groups = (from g in domain.DiscussionGroupSet
            let threadCount = (from t in domain.DiscussionThreadSet where t.DiscussionGroup==g && t.IsReadOnly==false select t).Count()
            let postCount = (from t in domain.DiscussionThreadSet where t.DiscussionGroup == g from m in t.Messages select m.Id).Count()
            let lastMessage = (from t in domain.DiscussionThreadSet where t.DiscussionGroup == g from m in t.Messages orderby m.DateOfPublishing descending select new DiscussionGroupCategoryDto.DiscussionMessageDto { Id = m.Id, AuthorName = m.AuthorName, DateOfPublishing = m.DateOfPublishing, Subject = m.Subject, ThreadId = m.DiscussionThread.Id }).FirstOrDefault()
            where g.Category.Id == c.Id orderby g.Name select new DiscussionGroupCategoryDto.DiscussionGroupDto { Id = g.Id, Description = g.Description, Name = g.Name, NumberOfThreads=threadCount, NumberOfPosts=postCount, LastMessage=lastMessage }).ToList();

 

Technorati Tag: ,

posted @ mercoledì 3 giugno 2009 16:44

Print

Comments on this entry:

# re: La potenza è nulla senza controllo

Left by Antonio Di Motta at 03/06/2009 18:12
Gravatar
Secondo me è "arte moderna".

# re: La potenza è nulla senza controllo

Left by Nazareno at 03/06/2009 18:23
Gravatar
Faccio finta di non capire per problemi di identazione :-)

# re: La potenza è nulla senza controllo

Left by Roberto Messora at 03/06/2009 19:08
Gravatar
io direi:
"si... può... faaaaarreeeeee!" (cit.)

# re: La potenza è nulla senza controllo

Left by raffaeu at 03/06/2009 19:41
Gravatar
Beh a sto punto faceva prima a restare a DAO e al recordset ... mi piacerebbe vedere il SQL Profiler come sclera con una cosa del genere. Lol

# re: La potenza è nulla senza controllo

Left by Igor A. at 03/06/2009 20:50
Gravatar
Sinceramente mi piacerebbe sapere cosa ne pensi dell'uso "estremo" di EF.
Qualcuno, giustamente, mi ha fatto tornare in mente DAO...non vorremmo ritrovarci a "sputare sul codice in cui abbiamo mangiato" (come con i DataSet)...

# re: La potenza è nulla senza controllo

Left by Douglas at 03/06/2009 23:00
Gravatar
42 !

# re: La potenza è nulla senza controllo

Left by shine at 29/09/2009 11:33
Gravatar
Faccio finta di non capire per problemi di identazione :-)

Your comment:



 (will not be displayed)


 
 
Please add 7 and 5 and type the answer here:
 

Live Comment Preview:

 
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011