Let's say we have schema like this (simplified):

Article
{
    Article_Id (PK, int)
    Title (string)
}

User
{
    User_Id (PK, int)
    Username (string)
}

ArticleUserLikes
{
    User_Id (Composite PK Part, int)
    Article_Id (Composite PK Part, int)
    *Like (boolean)*
}

Lets say I want the Article class to look like:

public class Article
> {
>     public int Id {get;set;}
>     public int Title {get;set;}
>
> *    public int TotalLikes {get;set;}
>     public int TotalDislikes {get;set;}*
> }
>

Where *TotalLikes *for Article with Id = 1 is soemthing like:

SELECT COUNT(Like) FROM ArticleUserLikes WHERE Article_Id = 1 AND Like =
TRUE

And *TotalDislikes *for Article with Id = 1 is soemthing like:

SELECT COUNT(Like) FROM ArticleUserLikes WHERE Article_Id = 1 AND Like =
FALSE


*How can I map TotalLikes and TotalDislikes ?*


Regards,

--
Mohamed Meligy
Information Analyst (.Net Technologies) – Applications Delivery - TDG
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.mel...@gmail.com
Weblog: http://weblogs.asp.net/meligy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to