Esempio n. 1
0
 /// <summary>Initializes static members of the <see cref="DocumentStore"/> class.</summary>
 static DocumentStore()
 {
     SingletonInstance = new EmbeddableDocumentStore
     {
         DataDirectory = DalUtils.GetDbPath()
     };
     SingletonInstance.Initialize();
 }
Esempio n. 2
0
 /// <summary>
 /// Loads the player document.
 /// </summary>
 /// <param name="databaseId">The database id.</param>
 /// <returns>The loaded PlayerDocument.</returns>
 public static PlayerDocument LoadPlayerDocument(long databaseId)
 {
     using (var ravenSession = DalUtils.GetRavenSession())
     {
         return((from pd in ravenSession.Query <PlayerDocument>()
                 where pd.DatabaseId == databaseId
                 select pd).FirstOrDefault());
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Loads the player document.
 /// </summary>
 /// <param name="playerName">Name of the player.</param>
 /// <returns>The loaded PlayerDocument.</returns>
 public static PlayerDocument LoadPlayerDocument(string playerName)
 {
     using (var ravenSession = DalUtils.GetRavenSession())
     {
         return((from pd in ravenSession.Query <PlayerDocument>()
                 where pd.Name.Equals(playerName, StringComparison.CurrentCultureIgnoreCase)
                 select pd).FirstOrDefault());
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Saves the player document.
 /// </summary>
 /// <param name="playerDocument">The player document to be saved.</param>
 public static void SavePlayerDocument(PlayerDocument playerDocument)
 {
     using (var ravenSession = DalUtils.GetRavenSession())
     {
         // RavenDB will automatically either insert a new document or update the
         // existing document with this document ID, as appropriate.
         ravenSession.Store(playerDocument);
         ravenSession.SaveChanges();
     }
 }