[ASP. NET] userid of membership in ASP. NET 2.0

Source: Internet
Author: User
Tags dnn

Beginning with ASP. NET 2.0, we have tried to unify some public infrastructure to the maximum extent and introduced the provider mode! Membership, profile, personalization, and so on are typical. With these unified infrastructure, we can write a fewCodeYou don't even need to write any code to achieve the effect that was previously achieved through the effort of both cool and cool, and these codes have been precisely tested, this can greatly reduce the problems introduced due to this code, so it is more economical for some websites to use them!

The USERID problem in membership is mentioned here. I don't know why. The USERID type of the membership data table "aspnet_users" and other userids is uniqeidentifier, that is, the guid with 128 bits, maybe it is to ensure uniqueness !? However, in the company's existing projects and ideally, the Data Type I want to use is int, especially in e-commerce websites, userid is associated with a large number of data tables, such as order tables, in addition, this field is widely used in statistical queries. If userid is of the uniqueindentifier type, the query speed will be somewhat higher than that of the int type.Program(Note: not tested), and in some cases, the role of the userid is similar to the serial number, the readability is better, there is a certain degree of convenience in the background maintenance.

The USERID we need now must be of the int type, regardless of the historical or other reasons! What should I do? The USERID in the membership provided by ASP. NET is uniqueidentifier, which is already a fact and cannot be changed! It seems a pity that we have completely abandoned this set of things because of it. After consideration and reference to dnn implementation, we have summarized the following two solutions:

    1. Add an int-type field bizuserid to the aspnet_users table: the specific business table is associated with bizuserid instead of userid. If membershipprovider is not implemented again, we can set bizuserid to an auto-increment field!
    2. Create a one-to-one Association Table users for the aspnet_users table. They are associated with the original userid. The users table also provides a bizuserid field of the int type. The business table is associated with this field: dnn uses this method. To maintain synchronization between two tables, membershipprovider must be rewritten, which requires a certain amount of work. However, due to the introduction of the users table, we can store some additional information in it, especially when you migrate legacy systems, this method is relatively simple and practical.

Finally, I have a small question. I don't know if you will directly use the membership set in your project, or will you implement a new set by yourself? I don't have any project experience. I'm curious. I want to know how you choose it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.