ServiceStack/ServiceStack.Contrib — pull request #20 by khalidabuhakmeh (2013-01-29 18:45:06+00:00)
Title: Added RavenUserAuthRepository Indexes

The original implementation was great, but was depending on temporary indexes to query for users and emails. The issue with this is temporary indexes is that they are cleared after a period of inactivity and you will get no results back as it builds that index for the first time.

The changes here insure that you are hitting indexes that are permanent and that will be as current as any other RavenDB index.

ServiceStack/UserAuth/ByUsernameOrEmail
ServiceStack/UserAuth/ByOAuthProvider

You can either call the static method I provided and it will execute the indexes on your DocumentStore, or the first time a RavenUserAuthRepository is created the indexes will be PUT into the database. RavenDB is smart about index changes so even if it is called a few times it is not a huge performance hit (no need to do any locking).

I've tested this in another project and it seems to be working nicely, but please test this out yourself.