Created
March 27, 2012 14:48
-
-
Save mverzilli/2216540 to your computer and use it in GitHub Desktop.
Original service method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public User GetUserByEmail(string email) | |
{ | |
var key = email; | |
var user = Cache.Cache.Get<User>(key); | |
if (user == null) | |
{ | |
try | |
{ | |
user = builder.BuildFromNewDbs(email); | |
} | |
catch (UserNotFoundException) | |
{ | |
try | |
{ | |
user = builder.BuildFromOldDbs(email); | |
} | |
catch (UserNotFoundException e) | |
{ | |
Trace.TraceError("Something failed because there's not a user with that email.", DateTime.Now, email); | |
throw new UserNotFoundException(); | |
} | |
} | |
Cache.Cache.Set(key, user); | |
} | |
return user; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment