Пример #1
0
        //-----------------------------------------------------------------------------
        public override object save(string serializer_name, CEntity entity, CEntityDef entity_def, object param)
        {
            string db_key = entity.getEntityType() + "_" + entity.getEntityId();

            Dictionary <string, object> map_prop = entity_def.getMapPropertyValue();
            string json_map_prop = JsonConvert.SerializeObject(map_prop);

            Enyim.Caching.Memcached.Results.IStoreOperationResult ret =
                CCouchbaseClient.Instance.ExecuteStore(StoreMode.Set, db_key, json_map_prop, Couchbase.Operations.PersistTo.Zero);

            if (ret.Success)
            {
                //mLog.Info("-------- Db Begin --------");
                //mLog.Info("CEntitySerializerDb save entity to db: entity_type=" + entity.getEntityType() + " entity_id=" + entity.getEntityId());
                //mLog.Info("-------- Db End --------");
            }
            else
            {
                //mLog.Error("CEntitySerializerDb::save() error! ");
                //mLog.Error("save entity to db: entity_type=" + entity.getEntityType() + " entity_id=" + entity.getEntityId());
                //mLog.Error(ret.Message);
                //mLog.Error(json_map_prop);
            }

            return(null);
        }
Пример #2
0
 //---------------------------------------------------------------------
 public bool executeStore(string db_key, string json_data)
 {
     Enyim.Caching.Memcached.Results.IStoreOperationResult ret =
         mCouchbaseClient.ExecuteStore(StoreMode.Set, db_key, json_data, Couchbase.Operations.PersistTo.Zero);
     if (ret.Success)
     {
         return(true);
     }
     else
     {
         //mLog.Error("CEntitySerializerCouchbase.handleSave() error! ");
         //mLog.Error("save entity to db: entity_type=" + data.entity_type + " entity_id=" + data.entity_guid);
         //mLog.Error(ret.Message);
         //mLog.Error(json_map_prop);
         return(false);
     }
 }