Click here to Skip to main content
16,009,640 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to use add friend concept in my asp.net application with database

What I have tried:

I am not use any solution for my asp.net application
Posted
Updated 6-Apr-16 12:22pm
Comments
Patrice T 6-Apr-16 16:32pm    
Do you really think someone else but you can understand your question ?
Sergey Alexandrovich Kryukov 6-Apr-16 18:07pm    
Positively, there is no such concept as "friend" in ASP.NET.
(There are friend members in C++, that's not it. :-)
You have to create such concept on the application level. How you do it depends on your design. You do it, not .NET, not ASP.NET...
—SA

1 solution

Please see my comment to the question.

For example…

In .NET code, create a class "Person". Add members you need, such as "Name", "Nickname", "Avatar" (or just "Avatar image"), some contact information, and so on. From this class, derive a class "Hipster". First and foremost, in this class, design and implement the function "Like". Then create an interface "IFriend". Add further classed derived from "Hipster", some implementing this interface, some not. Pass instances of this class to objects using the concept of friendship using the variable/member/parameter type "IFriend" (you don't want to consider the concept of friendship with other types of "Person", right? :-)). Alternatively, implement IFriend interface in the class "Hipster", but make it a relationship with other members of this type. The relationship should be one-directional graph, not symmetric: A.IsFriendOf(B) does not imply B.IsFriendOf(A); the users add members to the friend collection (or don't) without reciprocity.

A relational database is one of the most suitable ways of storing the relationships in a persistent way: Relational model — Wikipedia, the free encyclopedia[^].

And so on…

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900