Use of User table for anonymous users

Dec 14, 2008 at 10:32 PM
Edited Dec 14, 2008 at 11:33 PM

Using the User table for the anonymous user Name and Email fields would save storage space and avoid dozens of extra tables over time.  Three existing tables can be eliminated: MessageToAnonymous, CommentAnonymous and SubscriptionAnonymous.  Future tables like AnonymousLanguage can be avoided.

The anonymous user's DisplayName would be optional.  Their password could be auto-generated and their email address could be inserted as the unique username.

Currently, to make a City or PostalCode a required field for all posts, we’d have to update multiple table where the anonymous name and email was saved.  The alternative of adding a table called Anonymous would add unnecessary redundancy with the User table.  Reports that show the email of contributors currently require hitting multiple tables.  Querying one table called User for all names will make coding simple.

If an anonymous user submits an existing email address, Oxite could display the message “This email address has been used previously.  If you wish to validate, click to send yourself an email.  This verification message would not need to be displayed if the anonymous user is using a browser with a cookie relating them to their previous post.   If the user chooses not to validate and an existing email is found, create a new User row.

It’s great to support the ability to make a post without creating a full account, or to start selecting areas of interest or build a commerce order before entering a profile.  Using the User table for these anonymous cases will allow subsequent registration to occur without moving relations from an Anonymous table to a User table.  After posting an item, the anonymous user could see the message “Thanks, please enter a username and password if you'd like to recall and edit your post during return visits.

A remaining question is how would managing anonymous users in the User table sync with the MVC Membership project?   There’s already an aspnet_Users.IsAnonymous field in this AspNetDB database.  AspNetDB is used by MVC Storefront, so managing anonymous users in a similar manner may already be supported.

Dec 14, 2008 at 11:24 PM
Edited Dec 14, 2008 at 11:25 PM
I agree that MessageToAnonymous, CommentAnonymous and SubscriptionAnonymous smell like duplication. There seems to be some code duplication around it, but the model doesn't seem to be quite so simple - see for instance interface IPostRepository

  void AddComment(IComment comment, ICommentAnonymous commentAnonymous, ISubscription subscription, ISubscriptionAnonymous subscriptionAnonymous);"

So sometime you need both of these? I wish there were docs on how it worked...