Created
July 30, 2012 13:15
-
-
Save BillKeenan/3206786 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Share GetShare(string shareId) | |
{ | |
try | |
{ | |
using (var session = DocumentStore.OpenSession()) | |
{ | |
var share = (from m in session.Query<Share>() where m.Id == shareId select m).FirstOrDefault(); | |
//session.Query<Share>(shareId).FirstOrDefault(x => x.Id == shareId) ?? | |
// session.Query<Share>().Where(x => x.Id == shareId).Customize( | |
// x => x.WaitForNonStaleResults(TimeSpan.FromSeconds(5))).FirstOrDefault(); | |
if (share == null) | |
{ | |
_loggerService.Info("waiting for non-stale:" + shareId); | |
share = (from m in session.Query<Share>() where m.Id == shareId select m).Customize(x=>x.WaitForNonStaleResults()).FirstOrDefault(); | |
} | |
_loggerService.Info(String.Format("{0} share found?",(share!=null?share.Id:"nope"))); | |
return share; | |
} | |
}catch (Exception e) | |
{ | |
_loggerService.Fatal(e); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment