如何在ASP.NET中实现添加好友技术 [英] How to implement add friend technic in ASP.NET that

查看:102
本文介绍了如何在ASP.NET中实现添加好友技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的asp.net应用程序中使用数据库添加朋友概念



我尝试过:



我的asp.net应用程序没有使用任何解决方案

解决方案

请参阅我对该问题的评论。



例如...



在.NET代码中,创建一个Person类。添加您需要的成员,例如姓名,昵称,阿凡达(或仅阿凡达图片),某些联系信息等。从这个类中,派生出一个时髦类。首先,在本课程中,设计并实现Like功能。然后创建一个界面IFriend。添加从Hipster派生的进一步分类,一些实现此接口,一些不是。使用变量/ member / parameter类型IFriend使用友谊的概念将此类的实例传递给对象(您不想考虑与其他类型的Person的友谊的概念,对吧?:-))。或者,在Hipster类中实现IFriend接口,但使其与此类型的其他成员建立关系。这种关系应该是单向图,而不是对称的:A.IsFriendOf(B)并不意味着B.IsFriendOf(A);用户在没有互惠的情况下将成员添加到朋友集合(或不添加)。



关系数据库是以持久方式存储关系的最合适方式之一:关系模型 - 维基百科,免费的百科全书 [ ^ ]。



依旧......



-SA

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

解决方案

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


这篇关于如何在ASP.NET中实现添加好友技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆