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); }
public void Send(string collection, object data, OnErrorHandler onError = null, OnDataAddedHandler onSuccess = null) { var command = this.Command(collection); command.AddData(data, onError, onSuccess); }
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; }