[longomatch] Fix DB serialization



commit d05cf29d250531e49e32effd9e2551bc6f689b88
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Jun 10 11:15:18 2014 +0200

    Fix DB serialization

 LongoMatch.Services/Services/FileDB.cs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Services/Services/FileDB.cs b/LongoMatch.Services/Services/FileDB.cs
index 817a4be..35d1ee4 100644
--- a/LongoMatch.Services/Services/FileDB.cs
+++ b/LongoMatch.Services/Services/FileDB.cs
@@ -46,6 +46,7 @@ namespace LongoMatch.DB
                        if (File.Exists(dbPath)) {
                                try {
                                        projectsDB = SerializableObject.Load<LiteDB> (dbPath);
+                                       projectsDB.DBPath = dbPath;
                                }
                                catch  (Exception e){
                                        Log.Exception (e);
@@ -216,10 +217,9 @@ namespace LongoMatch.DB
        [Serializable]
        class LiteDB
        {
-               string dbPath;
                
                public LiteDB (string dbPath) {
-                       this.dbPath = dbPath;
+                       DBPath = dbPath;
                        ProjectsDict = new Dictionary <Guid, ProjectDescription>();
                        Version = new System.Version (Constants.DB_MAYOR_VERSION,
                                                      Constants.DB_MINOR_VERSION);
@@ -228,6 +228,11 @@ namespace LongoMatch.DB
                
                public LiteDB () { }
                
+               public string DBPath {
+                       get;
+                       set;
+               }
+               
                public Version Version {get; set;}
                
                public Dictionary<Guid, ProjectDescription> ProjectsDict {get; set;}
@@ -261,7 +266,7 @@ namespace LongoMatch.DB
                        bool ret = false;
                        
                        try {
-                               SerializableObject.Save (this, dbPath);
+                               SerializableObject.Save (this, DBPath);
                                ret = true;
                        } catch (Exception ex) {
                                Log.Exception (ex);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]