您将如何制作“最喜欢的页面”?系统
因此,我的管理层要求我采用一种方法,让用户将我网站中的页面标记为“最喜欢的”,并将它们显示在特殊列表中。该网站具有静态结构(我不生成页面)。我想知道最好的方法。我的第一个想法是将其存储在数据库中(因为用户信息也存储在那里),但我想我也可以使用 ASP.NET 的 Profile 属性。还有其他我没有考虑过的方法吗?大家会怎么做呢?
So I was asked by my management to incorporate a way for users to mark pages in my website as "favorite" and have them show up in a special list. This site has a static structure (I do not generate pages). I am wondering about the best way to do that. My first thought was to store it in the database (since user information is also stored there), but I suppose I could also use the Profile properties of ASP.NET. Is there any other ways I have not considered? How would you all do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会使用数据库,主要是因为我想存储具有某些属性的列表(具体来说,url列表,其中有关页面标题、收藏的用户等的详细信息)。我很可能会在我的数据库中做这样的事情:
如果您使用配置文件属性,您将为每个用户维护一个链接列表,基本上在每个用户的(序列化?)字符串中(因为这就是配置文件属性的存储方式) ...)。如果某个页面的标题或 URL 发生更改,您将无法更新该页面并将其反映在所有用户的页面上。
I'd use a database, mainly because I want to store a list of things with certain properties (specifically, a list of urls, with details on page title, user that favorited etc). Most likely I'd do something like this in my DB:
If you use profile properties, you're maintaing a list of links for each user, basically in a (serialized?) string for each user (for that's how profile properties are stored...). If the title or url of one page changes, there's no way for you to update that and have it reflected on all the users' pages.
当存储多条信息并将其存储在一个单独的表中时,您很可能会获得更好的性能,其中包含 UserId、PageUrl、PageTitle 或类似的内容,以便所有信息一次性可用。
这还使您可以集中访问常用链接,如果您从系统中删除页面,则可以将其快速从“收藏夹”系统中删除。
More than likely you will get better performance when storing multiple pieces of information to store this in a separate table with something like UserId, PageUrl, PageTitle or something similar so that the information is all available at once.
This also gives you centralized access to common links, should you remove a page from the system, you could then remove it quickly from the "Favorites" system.
我会选择数据库。让人们对页面进行投票并记住投票结果,以便人们可以更改他们的投票。计算总数和/或平均值(取决于投票机制)并从中获取。
如果您谈论单个用户系统(不将用户 A 投票与用户 B 投票相关联),您可以使用配置文件 mechainsm,因为无论如何您都会存储一个小列表。您所要做的就是有效地查询这些内容的机制(作为管理员)。
很大程度上是基于个人喜好的设计决策。争论可以从两个方向进行。我可能会选择数据库 - 考虑到更容易维护和以后的扩展。
I would go for database. have people vote for pages and remember the votes, so people can change their vote. Calcualte totals and / or average (depending on voting cmechanism) and take it from there.
If you talk of a single user system (not correlating user A votes with user B votes) you CAN use the profile mechainsm as you will store a small list anyway. What you do loose is the mecahnism to query for those efficiently (as administrator).
Pretty largely a design decision based on personal preferences. Arguments ca nbe made in both directions. I would possibly go with the database - in the light of easier maintenance and later expansion.