Okay, simple question.. :)
In my webportal I got users, who obviously need to log on.
I got a table with users in a MSSQL-DB:
- PK - GUID - UserId
- CK - nvarchar - Email
- CK - nvarchar - PhoneNumber
Now, I want users to be able to log on to my site using either their phonenumber or email, so I need to somehow fetch a user using either the phonenumber or email (both of which are guarenteed to be unique).
In NHibernate, the ISession only allows me to load an entity using the primary key (which is basically a surrogate key in my case). Is there anyway to load entities using candidate keys?
I'm very rusty in database-design, so this might be poor design, but I really think it's somewhat common to have a scheme like this - but if it is poor design, please let me know :)
Thanks in advance