内置的用户个人资料与旧式用户类/表的ASP.NET [英] ASP.NET built in user profile vs. old style user class/tables

查看:65
本文介绍了内置的用户个人资料与旧式用户类/表的ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关在ASP.NET中使用配置文件功能的最佳实践的指南.

I am looking for guidance regarding the best practice around the use of the Profile feature in ASP.NET.

您如何确定应将哪些内容保留在内置用户配置文件中,还是应该创建自己的数据库表并为所需字段添加一列?例如,一个用户有一个邮政编码,我应该将该邮政编码保存在自己的表中,还是应该将其添加到web.config xml配置文件中并通过用户配置文件ASP.NET机制进行访问?

How do you decide what should be kept in the built-in user Profile, or if you should create your own database table and add a column for the desired fields? For example, a user has a zip code, should I save the zip code in my own table, or should I add it to the web.config xml profile and access it via the user profile ASP.NET mechanism?

我现在能想到的优点/缺点是,由于我不太了解配置文件(现在只是一个 Matrix ),我可能可以做任何我想做的事情我是否要走表路线(例如,SQL以使所有用户都使用与当前用户相同的邮政编码).我不知道如果使用ASP.NET配置文件是否可以执行相同操作.

The pros/cons I can think of right now are that since I don't know the profile very well (it is a bit of a Matrix right now), I probably can do whatever I want if I go the table route (e.g., SQL to get all the users in the same zip code as the current user). I don't know if I can do the same if I use the ASP.NET profile.

推荐答案

我仅构建了2个使用概要文件提供程序的应用程序.从那时起,我一直远离使用它.对于这两个应用程序,我都使用它来存储有关用户的信息,例如他们的公司名称,地址和电话号码.

Ive only built 2 applications that used the profile provider. Since then I have stayed away from using it. For both of the apps I used it to store information about the user such as their company name, address and phone number.

这很好,直到我们的客户希望能够通过这些字段之一找到用户. 搜索涉及遍历每个用户个人资料,并将信息与搜索条件进行比较.随着用户群的增加,我们的客户无法接受的搜索时间.唯一的解决方案是创建一个表来存储用户信息.搜索速度大大提高了.

This worked fine until our client wanted to be able to find a user by one of these fields. Searching involved looping through every users profile and comparing the information to the search criteria. As the user base grew the search time became unacceptable to our client. The only solution was to create a table to store the users information. Search speed was increased immensely.

我建议将这种类型的信息存储在自己的表中.

I would recommend storing this type of information in its own table.

这篇关于内置的用户个人资料与旧式用户类/表的ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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