Пример #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);
 }