Ejemplo n.º 1
0
 public void AddData(object data, OnErrorHandler onError = null, OnDataAddedHandler onSuccess = null)
 {
     if (onError == null)
     {
         onError = this.OnError;
     }
     if (onSuccess == null)
     {
         onSuccess = this.OnSuccess;
     }
     DataItem item = null;
     try
     {
         item = new DataItem(data, onError, onSuccess);
     }
     catch (Exception exc)
     {
         onError(exc);
         return;
     }
     this.queue.Enqueue(item);
     this.Send(this.Config.BatchSize);
 }
Ejemplo n.º 2
0
 public void Send(string collection, object data, OnErrorHandler onError = null, OnDataAddedHandler onSuccess = null)
 {
     var command = this.Command(collection);
     command.AddData(data, onError, onSuccess);
 }
Ejemplo n.º 3
0
 internal DataItem(object data, OnErrorHandler onError, OnDataAddedHandler onSuccess)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     var type = data.GetType();
     if (!(type.IsClass && !type.IsPrimitive))
     {
         throw new Exception("Invalid parameter");
     }
     this.Data = data;
     this.OnError = onError;
     this.OnSuccess = onSuccess;
 }