예제 #1
0
        void ZNodeManager_NodeWhisperEvent(object sender, ZyreEventWhisper e)
        {
            try
            {
                var eventData = e.ConvertTo<ZNodeEntry>();
                var commandInfo = DLiteUtil.Analyze(eventData.Command);
                var args = eventData.Entry as object[];
                object obj = this;

                if (!commandInfo.Provider.Equals(Name))
                {
                    obj = GetCollection(commandInfo.Provider); ;
                }

                var method = obj.FindMethod(commandInfo.Action, ref args);
                if (method == null) return;

                var key = DLiteUtil.BuildKey(new object[] { eventData.Command }.Concat(args));
                DLiteUtil.OffRaiser(key);
                method.Invoke(obj, args);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
예제 #2
0
 public bool DropCollection(string name)
 {
     DLiteUtil.Whisper(Name, "DropCollection", new object[] { name });
     return db.Value.DropCollection(name);
 }
예제 #3
0
 public bool RenameCollection(string oldName, string newName)
 {
     DLiteUtil.Whisper(Name, "RenameCollection", new object[] { oldName, newName });
     return db.Value.RenameCollection(oldName, newName);
 }
예제 #4
0
 public int Delete(Query query)
 {
     DLiteUtil.Whisper(Name, "Delete", new object[] { query });
     return(LiteCollection.Delete(query));
 }
예제 #5
0
 public bool DropIndex(string name)
 {
     DLiteUtil.Whisper(Name, "DropIndex", new object[] { name });
     return(LiteCollection.DropIndex(name));
 }
예제 #6
0
 public bool Delete(BsonValue id)
 {
     DLiteUtil.Whisper(Name, "Delete", new object[] { id });
     return(LiteCollection.Delete(id));
 }
예제 #7
0
 public int Delete(Expression <Func <T, bool> > predicate)
 {
     DLiteUtil.Whisper(Name, "Delete", new object[] { predicate });
     return(LiteCollection.Delete(predicate));
 }
예제 #8
0
 public int Update(IEnumerable <T> entities)
 {
     DLiteUtil.Whisper(Name, "Update", new object[] { entities });
     return(LiteCollection.Update(entities));
 }
예제 #9
0
 public bool Update(T entity)
 {
     DLiteUtil.Whisper(Name, "Update", new object[] { entity });
     return(LiteCollection.Update(entity));
 }
예제 #10
0
 public bool Update(BsonValue id, T entity)
 {
     DLiteUtil.Whisper(Name, "Update", new object[] { id, entity });
     return(LiteCollection.Update(id, entity));
 }
예제 #11
0
 public int InsertBulk(IEnumerable <T> entities, int batchSize = 5000)
 {
     DLiteUtil.Whisper(Name, "InsertBulk", new object[] { entities, batchSize });
     return(LiteCollection.InsertBulk(entities, batchSize));
 }
예제 #12
0
 public BsonValue Insert(T entity)
 {
     DLiteUtil.Whisper(Name, "Insert", new object[] { entity });
     return(LiteCollection.Insert(entity));
 }
예제 #13
0
 public int Insert(IEnumerable <T> entities)
 {
     DLiteUtil.Whisper(Name, "Insert", new object[] { entities });
     return(LiteCollection.Insert(entities));
 }
예제 #14
0
 public void Insert(BsonValue id, T entity)
 {
     DLiteUtil.Whisper(Name, "Insert", new object[] { id, entity });
     LiteCollection.Insert(id, entity);
 }