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 virtual int Id {get; private set;}
> public virtual int Title {get;set;}
>
> * public **virtual **int TotalLikes {get;** **private **set;}
> public **virtual **int TotalDislikes {get; **private **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: [email protected]
Weblog: http://weblogs.asp.net/meligy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---