Esempio n. 1
0
 public virtual bool Add(TItem item)
 {
     if (!Validate(item))
     {
         return(false);
     }
     try
     {
         _dataConnector.Insert(item);
     }
     catch (Exception e)
     {
         Debug.Log("Can't insert object " + item.Justify() + " because error: " + e.Message);
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
        private void RewriteActualDataSignatures(List <Dictionary <string, string> > keepers, List <Dictionary <string, string> > items)
        {
            try
            {
                DataKeepersDbConnector streaming = new DataKeepersDbConnector();
                DataKeepersDbConnector local     = new DataKeepersDbConnector();
                local.ConnectToLocalStorage();
                local.DropTableIfExists(typeof(KeeperSignature).Name);
                local.CreateTable <KeeperSignature>();
                streaming.ConnectToStreamingStorage();
                streaming.DropTableIfExists(typeof(KeeperSignature).Name);
                streaming.CreateTable <KeeperSignature>();
                // generate sql
                foreach (var keeper in keepers)
                {
                    var kSignature = new KeeperSignature
                    {
                        KeeperName = keeper["Type"],
                        ItemType   = keeper["Items"]
                    };
                    local.Insert(kSignature);
                    streaming.Insert(kSignature);
                }

                foreach (var item in items)
                {
                    local.DropTableIfExists(item["Type"]);
                    streaming.DropTableIfExists(item["Type"]);
                    var query = GenerateCreateTableQueryFromSignature(item);
//                    Debug.Log(query);
                    if (!local.Query(query))
                    {
                        Debug.Log("Error when executing creating of table " + item["Type"]);
                    }
                    if (!streaming.Query(query))
                    {
                        Debug.Log("Error when executing creating of table " + item["Type"]);
                    }
                }
                local.Close();
                streaming.Close();
                Debug.Log("Current signatures rewrited successfully!");
            }
            catch (Exception e)
            {
                Debug.LogError("Signature rewriting error: " + e.Message);
            }
        }
Esempio n. 3
0
 public void SaveKeeperVersion(KeeperVersion version)
 {
     _dbEditor.Insert(version);
 }