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


C# IDocumentStore.WaitForStaleIndexesToComplete方法代码示例

本文整理汇总了C#中IDocumentStore.WaitForStaleIndexesToComplete方法的典型用法代码示例。如果您正苦于以下问题:C# IDocumentStore.WaitForStaleIndexesToComplete方法的具体用法?C# IDocumentStore.WaitForStaleIndexesToComplete怎么用?C# IDocumentStore.WaitForStaleIndexesToComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDocumentStore的用法示例。


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

示例1: CreateSeedData

        public static void CreateSeedData(IDocumentStore documentStore)
        {
            Condition.Requires(documentStore).IsNotNull();

            using (IDocumentSession documentSession = documentStore.OpenSession())
            {
                // First, check to make sure we don't have any data.
                var user = documentSession.Load<User>(1);
                if (user != null)
                {
                    // ooOooo! we have a user, so it's assumed we actually have some seeded data.
                    return;
                }

                // We have no users, so it's assumed we therefore have no data at all.
                // So lets fake some up :)

                // Users.
                ICollection<User> users = FakeUsers.CreateFakeUsers(50);
                StoreFakeEntities(users, documentSession);

                // Questions.
                ICollection<Question> questions = FakeQuestions.CreateFakeQuestions(users.Select(x => x.Id).ToList());
                StoreFakeEntities(questions, documentSession);

                documentSession.SaveChanges();

                // Make sure all our indexes are not stale.
                documentStore.WaitForStaleIndexesToComplete();
            }
        }
开发者ID:neiz,项目名称:RavenOverflow,代码行数:31,代码来源:HelperUtilities.cs

示例2: CreateSeedData

        public static void CreateSeedData(IDocumentStore documentStore)
        {
            Condition.Requires(documentStore).IsNotNull();

            using (IDocumentSession documentSession = documentStore.OpenSession())
            {
                // Users.
                ICollection<User> users = FakeUsers.CreateFakeUsers(50);
                StoreFakeEntities(users, documentSession);

                // Questions.
                ICollection<Question> questions = FakeQuestions.CreateFakeQuestions(users.Select(x => x.Id).ToList());
                StoreFakeEntities(questions, documentSession);

                documentSession.SaveChanges();

                // Make sure all our indexes are not stale.
                documentStore.WaitForStaleIndexesToComplete();
            }
        }
开发者ID:heinrichbreedt,项目名称:RavenOverflow,代码行数:20,代码来源:HelperUtilities.cs

示例3: CreateSeedDataAsync

        private static async Task CreateSeedDataAsync(IEnumerable<IEnumerable> seedData, IDocumentStore documentStore)
        {
            if (documentStore == null)
            {
                throw new ArgumentNullException("documentStore");
            }

            if (seedData == null)
            {
                throw new ArgumentNullException("seedData");
            }

            using (var asyncDocumentSession = documentStore.OpenAsyncSession())
            {
                // First, check to make sure we don't have any data.
                if (documentStore.DatabaseCommands.GetStatistics().CountOfDocuments > 0)
                {
                    // We have documents, so nothing to worry about :)
                    return;
                }

                // Store each collection of fake seeded data.
                Trace.TraceInformation("Seeding Data :-");
                foreach (var collection in seedData)
                {
                    var count = 0;
                    var entityName = "Unknown";

                    foreach (var entity in collection)
                    {
                        count++;
                        if (count <= 1)
                        {
                            entityName = entity.GetType().ToString();
                        }
                        await asyncDocumentSession.StoreAsync(entity);
                    }
                    Trace.TraceInformation("   --- {0} {1}", count, entityName);
                }
                Trace.TraceInformation("   Done!");

                // Commit this transaction.
                await asyncDocumentSession.SaveChangesAsync();

                // Make sure all our indexes are not stale.
                documentStore.WaitForStaleIndexesToComplete();
            }
        }
开发者ID:PureKrome,项目名称:WorldDomination.RavenDb,代码行数:48,代码来源:DocumentStoreExtensions.cs

示例4: CreateSeedData

        private static void CreateSeedData(IEnumerable<IEnumerable> seedData, IDocumentStore documentStore)
        {
            if (documentStore == null)
            {
                throw new ArgumentNullException("documentStore");
            }

            if (seedData == null)
            {
                throw new ArgumentNullException("seedData");
            }

            using (IDocumentSession documentSession = documentStore.OpenSession())
            {
                // First, check to make sure we don't have any data.
                if (documentSession.Advanced.DocumentStore.DatabaseCommands.GetStatistics().CountOfDocuments > 0)
                {
                    // We have documents, so nothing to worry about :)
                    return;
                }

                // Store each collection of fake seeded data.
                Debug.WriteLine("Seeding Data :-");
                foreach (IEnumerable collection in seedData)
                {
                    int count = 0;
                    string entityName = "Unknown";

                    foreach (object entity in collection)
                    {
                        count++;
                        if (count <= 1)
                        {
                            entityName = entity.GetType().ToString();
                        }
                        documentSession.Store(entity);
                    }
                    Debug.WriteLine("   --- {0} {1}", count, entityName);
                }
                Debug.WriteLine("   Done!");

                // Commit this transaction.
                documentSession.SaveChanges();

                // Make sure all our indexes are not stale.
                documentStore.WaitForStaleIndexesToComplete();
            }
        }
开发者ID:bbqchickenrobot,项目名称:WorldDomination.RavenDb,代码行数:48,代码来源:DocumentStoreExtensions.cs


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