当前位置: 首页>>代码示例>>C#>>正文


C# IDataStore类代码示例

本文整理汇总了C#中IDataStore的典型用法代码示例。如果您正苦于以下问题:C# IDataStore类的具体用法?C# IDataStore怎么用?C# IDataStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDataStore类属于命名空间,在下文中一共展示了IDataStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueueProcessor

        public QueueProcessor(Logger log, IDataStore dataStore, IHubContext<IMatchmakingClient> hub, ITracker tracker, IMatchEvaluator matchBuilder, CircularBuffer<TimeSpan> timeToMatch)
        {
            _log = log;
            _dataStore = dataStore;
            _hub = hub;
            _tracker = tracker;
            _matchBuilder = matchBuilder;
            _timeToMatch = timeToMatch;

            _queueSleepMin = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepMin") );
            _queueSleepMax = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepMax") );
            _queueSleepLength = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepLength") );

            Task.Run( async () =>
            {
                _log.Info("Running QueueProcessor...");

                while( true )
                {
                    var sleepTime = _queueSleepMax;

                    try
                    {
                        await processQueue();
                        sleepTime = _queueSleepMax - (_dataStore.DocumentDbPopulation * (_queueSleepMax/_queueSleepLength));
                    }
                    catch(Exception ex)
                    {
                        _log.Error(ex);
                    }

                    Thread.Sleep(sleepTime < _queueSleepMin ? _queueSleepMin : sleepTime);
                }
            });
        }
开发者ID:spencerhakim,项目名称:firetea.ms,代码行数:35,代码来源:QueueProcessor.cs

示例2: init

 public void init()
 {
     _request = new HttpRequestMessage()
     {
         Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } }
     };
     _controller = new RecordsController
     {
         Request = _request
     };
     MockRepository repo = new MockRepository();
     _mockDataStore = repo.Stub<IDataStore>();
     SetupResult.For(_mockDataStore.GetRecords()).Return(
         new List<RecordDetail>{
             new RecordDetail
     {
         DateOfBirth = new DateTime(2000, 1, 1),
         FavColor = "Black",
         Gender = "Male",
         FirstName = "test",
         LastName = "testL"
     },new RecordDetail
     {
         DateOfBirth = new DateTime(2001, 1, 1),
         FavColor = "Blue",
         Gender = "Female",
         FirstName = "test",
         LastName = "lasttest"
     }
         }
         );
 }
开发者ID:srikanthdevineni,项目名称:demo-code,代码行数:32,代码来源:RecordsControllerTests.cs

示例3: AuthenticateOauth

        /// <summary>
        /// Authenticate to Google Using Oauth2
        /// Documentation https://developers.google.com/accounts/docs/OAuth2
        /// </summary>
        /// <param name="clientId">From Google Developer console https://console.developers.google.com</param>
        /// <param name="clientSecret">From Google Developer console https://console.developers.google.com</param>
        /// <param name="userName">A string used to identify a user.</param>
        /// <param name="datastore">datastore to use </param>
        /// <returns></returns>
        public static PlusService AuthenticateOauth(string clientId, string clientSecret, string userName, IDataStore datastore)
        {

            string[] scopes = new string[] { PlusService.Scope.PlusLogin,  // know your basic profile info and your circles
                                             PlusService.Scope.PlusMe,  // Know who you are on google
                                             PlusService.Scope.UserinfoEmail,   // view your email address
                                             PlusService.Scope.UserinfoProfile};     // view your basic profile info.

            try
            {
                // here is where we Request the user to give us access, or use the Refresh Token that was previously stored in %AppData%
                UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
                                                                                             , scopes
                                                                                             , userName
                                                                                             , CancellationToken.None
                                                                                             , datastore).Result;

                PlusService service = new PlusService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName = "Authentication Sample",
                });
                return service;
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.InnerException);
                return null;

            }

        }
开发者ID:StuWoody,项目名称:Google-Dotnet-Samples,代码行数:42,代码来源:Authenticaton.cs

示例4: HomeModule

        public HomeModule(IDataStore dataStore) {
            Get["/"] = _ => {
                var model = this.GetDefaultModel<StartContent>();
                model.Page.Title = "Start";

                using (var session = dataStore.DocumentStore.OpenSession()) {
                    session.Store(new Member() { Id = Guid.NewGuid(), Firstname = "Test", Lastname = "Last", Email = "[email protected]" });
                    session.SaveChanges();
                }

                using (var session = dataStore.DocumentStore.OpenSession()) {
                    var content = new StartContent();
                    content.Members = session.Query<Member>().ToList();
                    model.Content = content;
                }

                return View["start.cshtml", model];
            };

            Get["/cleanup"] = _ => {
                var model = this.GetDefaultModel<StartContent>();
                model.Page.Title = "Cleanup";

                using (var session = dataStore.DocumentStore.OpenSession()) {
                    //dataStore.DocumentStore.DatabaseCommands.DeleteByIndex
                    //session.SaveChanges();
                }

                return View["start.cshtml", model];
            };

            Get["/error"] = _ => { throw new NotImplementedException(); };
        }
开发者ID:mattanja,项目名称:kernetics.messenger,代码行数:33,代码来源:HomeModule.cs

示例5: AzureProfile

        public AzureProfile(IDataStore store, string profilePath)
        {
            this.store = store;
            this.profilePath = profilePath;

            Load();
        }
开发者ID:djrosanova,项目名称:azure-sdk-tools,代码行数:7,代码来源:AzureProfile.cs

示例6: BTCMarketsExchange

        public BTCMarketsExchange(IDataStore _dataStore, ICurrencyPairRepository _currencyPairRepository)
        {
            wallets = new List<CurrencyWallet>();
            pairsToUpdate = new List<BTCMarketsCurrencyWalletPair>();
            syntheticPairsToUpdate = new List<BTCMarketsSyntheticCurrencyWalletPair>();

            dataStore = _dataStore;
            var btcWallet = new FixedFeeCurrencyWallet(0.001M,0.001M, CurrencyType.Bitcoin , this);
            var ltcWallet = new FixedFeeCurrencyWallet(0.01M, 0.01M, CurrencyType.Litecoin, this);
            var audWallet = new PercentageFeeCurrencyWallet(0.01M, 0.015M, CurrencyType.AUD, this);

            wallets.Add(btcWallet);
            wallets.Add(ltcWallet);
            wallets.Add(audWallet);

            var btcusd = new BTCMarketsCurrencyWalletPair(btcWallet, audWallet, _dataStore, "https://api.btcmarkets.net/market/BTC/AUD/tick");
            var ltcusd = new BTCMarketsCurrencyWalletPair(ltcWallet, audWallet, _dataStore, "https://api.btcmarkets.net/market/LTC/AUD/tick");
            var btcltc = new BTCMarketsSyntheticCurrencyWalletPair(btcWallet, ltcWallet, _dataStore, "https://api.btcmarkets.net/market/BTC/AUD/tick", "https://api.btcmarkets.net/market/LTC/AUD/tick");

            pairsToUpdate.Add(btcusd);
            pairsToUpdate.Add(ltcusd);
            syntheticPairsToUpdate.Add(btcltc);

            _currencyPairRepository.Store(btcusd);
            _currencyPairRepository.Store(ltcusd);
            _currencyPairRepository.Store(btcltc);
        }
开发者ID:jamez1,项目名称:botcoin,代码行数:27,代码来源:BTCMarketsExchange.cs

示例7: ExceptionStateMachine

 public ExceptionStateMachine(IWorkItemRepository repository, IDataStore dataStore,
     IWorkflowPathNavigator navigator)
 {
     _repository = repository;
     _dataStore = dataStore;
     _navigator = navigator;
 }
开发者ID:mikezhuyuan,项目名称:simpleflow,代码行数:7,代码来源:ExceptionStateMachine.cs

示例8: CrossCopy

        ///<summary>
        /// Copy from one module to another. Can copy from s3 to disk and vice versa
        ///</summary>
        ///<param name="srcStore"></param>
        ///<param name="srcDomain"></param>
        ///<param name="srcFilename"></param>
        ///<param name="dstStore"></param>
        ///<param name="dstDomain"></param>
        ///<param name="dstFilename"></param>
        ///<returns></returns>
        ///<exception cref="ArgumentNullException"></exception>
        public static Uri CrossCopy(IDataStore srcStore, string srcDomain, string srcFilename, IDataStore dstStore,
                                    string dstDomain, string dstFilename)
        {
            if (srcStore == null) throw new ArgumentNullException("srcStore");
            if (srcDomain == null) throw new ArgumentNullException("srcDomain");
            if (srcFilename == null) throw new ArgumentNullException("srcFilename");
            if (dstStore == null) throw new ArgumentNullException("dstStore");
            if (dstDomain == null) throw new ArgumentNullException("dstDomain");
            if (dstFilename == null) throw new ArgumentNullException("dstFilename");
            //Read contents
            using (Stream srcStream = srcStore.GetReadStream(srcDomain, srcFilename))
            {
                using (var memoryStream = TempStream.Create())
                {
                    //Copy
                    var buffer = new byte[4096];
                    int readed;
                    while ((readed = srcStream.Read(buffer, 0, 4096)) != 0)
                    {
                        memoryStream.Write(buffer, 0, readed);
                    }

                    memoryStream.Position = 0;
                    return dstStore.Save(dstDomain, dstFilename, memoryStream);
                }
            }
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:38,代码来源:CrossModuleCopy.cs

示例9: InvokeDatabaseExported

		public static void InvokeDatabaseExported(IDataStore db)
		{
			if (OnDatabaseExported != null)
			{
				OnDatabaseExported.Invoke(new DatabaseExportedEventArgs(db));
			}
		}
开发者ID:greeduomacro,项目名称:RuneUO,代码行数:7,代码来源:Events.cs

示例10: FeedbackListViewModel

		public FeedbackListViewModel (Page page) : base(page)
		{
			Title = "Feedback";
			dataStore = DependencyService.Get<IDataStore> ();
			Feedbacks = new ObservableCollection<Feedback> ();
			FeedbacksGrouped = new ObservableCollection<Grouping<string, Feedback>> ();
		}
开发者ID:xamaringeek,项目名称:MyShoppe,代码行数:7,代码来源:FeedbackListViewModel.cs

示例11: Start

        public void Start(IScene scene)
        {
            m_scene = scene;

            m_dataStore = m_scene.Simian.GetAppModule<IDataStore>();
            if (m_dataStore == null)
            {
                m_log.Error("LLPrimitiveLoader requires an IDataStore");
                return;
            }

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            if (m_primMesher == null)
            {
                m_log.Error("LLPrimitiveLoader requires an IPrimMesher");
                return;
            }

            m_writeQueue = new ThrottledQueue<UUID, PrimSerialization>(5, 1000 * 30, true, SerializationHandler);
            m_writeQueue.Start();

            m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler;
            m_scene.OnEntityRemove += EntityRemoveHandler;

            Deserialize();
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:26,代码来源:LLPrimitiveLoader.cs

示例12: ObjectStore

 public ObjectStore(IDataStore dataStore, ISerializer serializer)
 {
     DataStore = dataStore;
     Serializer = serializer;
     CacheObjects = true;
     RemoveBadData = true;
 }
开发者ID:arumata,项目名称:Thingie.Tracking,代码行数:7,代码来源:ObjectStore.cs

示例13: LoadDataStoreItemData

 public static byte[] LoadDataStoreItemData(string domain, string fileLink, IDataStore storage)
 {
     using (var stream = storage.GetReadStream(domain, fileLink))
     {
         return stream.GetCorrectBuffer();
     }
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:7,代码来源:StorageManager.cs

示例14: Handle

        /// <summary>
        /// Handles the provided data store as part of the batch.
        /// </summary>
        /// <param name="store">The data store being handled as part of the batch.</param>
        public static void Handle(IDataStore store)
        {
            using (LogGroup logGroup = LogGroup.Start("Adding a data store to the batch.", LogLevel.Debug))
            {
                LogWriter.Debug("Batch stack: " + BatchState.Batches.Count.ToString());

                if (BatchState.IsRunning)
                {
                    Stack<Batch> batches = BatchState.Batches;

                    // Get the position of the outermost batch
                    // The stack is reversed so the last position is the outermost batch
                    int outerPosition = batches.Count-1;

                    // Get the outermost batch and add the data store to it
                    Batch batch = batches.ToArray()[outerPosition];

                    if (!batch.DataStores.Contains(store))
                    {
                        LogWriter.Debug("Data store added.");
                        batch.DataStores.Add(store);

                        // Commit the batch stack to state
                        Batches = batches;
                    }
                    else
                    {
                        LogWriter.Debug("Data store already found. Not added.");
                    }
                }
                else
                    throw new InvalidOperationException("No batch running. Use Batch.IsRunning to check before calling this method.");
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:38,代码来源:BatchState.cs

示例15: StoresViewModel

 public StoresViewModel(Page page) : base(page)
 {
     Title = "Locations";
     dataStore = DependencyService.Get<IDataStore>();
     Stores = new ObservableRangeCollection<Store>();
     StoresGrouped = new ObservableRangeCollection<Grouping<string, Store>>();
 }
开发者ID:JohnPaine,项目名称:learning,代码行数:7,代码来源:StoresViewModel.cs


注:本文中的IDataStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。