コード例 #1
1
 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;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 public CachedRunner(DataReaderObservableRunner original, IObserver <IDictionary <string, object> > observer)
 {
     _original    = original;
     _newObserver = observer;
 }
コード例 #7
0
 /// <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));
 }
コード例 #8
0
 public CachedRunner(DataReaderObservableRunner original, IObserver<IDictionary<string, object>> observer)
 {
     _original = original;
     _newObserver = observer;
 }