public static DataReaderObservableRunner RunAsync(IDbCommand command, IObserver<IDictionary<string, object>> observer)
 {
     var instance = new DataReaderObservableRunner(command, observer);
     var asyncAction = new Action(instance.Run);
     asyncAction.BeginInvoke(asyncAction.EndInvoke, null);
     return instance;
 }
        public static DataReaderObservableRunner RunAsync(IDbCommand command, IObserver <IDictionary <string, object> > observer)
        {
            var instance    = new DataReaderObservableRunner(command, observer);
            var asyncAction = new Action(instance.Run);

            asyncAction.BeginInvoke(asyncAction.EndInvoke, null);
            return(instance);
        }
 private static DataReaderObservableRunner CreateInstance(IDbCommand command, IObserver <IDictionary <string, object> > observer)
 {
     lock (StaticSync)
     {
         if (!RunnerCache.Contains(command))
         {
             var instance = new DataReaderObservableRunner(command, observer);
             RunnerCache.Add(command, instance);
             return(instance);
         }
     }
     return(null);
 }
 private static DataReaderObservableRunner CreateInstance(IDbCommand command, IObserver<IDictionary<string, object>> observer)
 {
     lock (StaticSync)
     {
         if (!RunnerCache.Contains(command))
         {
             var instance = new DataReaderObservableRunner(command, observer);
             RunnerCache.Add(command, instance);
             return instance;
         }
     }
     return null;
 }
        public static DataReaderObservableRunner RunAsync(IDbCommand command, IObserver <IDictionary <string, object> > observer)
        {
            DataReaderObservableRunner instance = null;

            if (!RunnerCache.Contains(command))
            {
                instance = CreateInstance(command, observer);
            }

            if (instance == null)
            {
                instance = new CachedRunner(RunnerCache.Get(command), observer);
            }
            var asyncAction = new Action(instance.Run);

            asyncAction.BeginInvoke(asyncAction.EndInvoke, null);
            return(instance);
        }
 public CachedRunner(DataReaderObservableRunner original, IObserver <IDictionary <string, object> > observer)
 {
     _original    = original;
     _newObserver = observer;
 }
 /// <summary>
 /// Notifies the provider that an observer is to receive notifications.
 /// </summary>
 /// <returns>
 /// The observer's interface that enables resources to be disposed.
 /// </returns>
 /// <param name="observer">The object that is to receive notifications.</param>
 public IDisposable Subscribe(IObserver <IDictionary <string, object> > observer)
 {
     return(DataReaderObservableRunner.RunAsync(_command, observer));
 }
 public CachedRunner(DataReaderObservableRunner original, IObserver<IDictionary<string, object>> observer)
 {
     _original = original;
     _newObserver = observer;
 }