public virtual void Test()
        {
            for (int i = 0; i < ObjectCount; i++)
            {
                Store(new CommitAfterDroppedFieldIndexTestCase.Item(1));
            }
            IStoredField storedField = FileSession().StoredClass(typeof(CommitAfterDroppedFieldIndexTestCase.Item
                                                                        )).StoredField("_id", null);

            storedField.CreateIndex();
            FileSession().Commit();
            IExtObjectContainer session  = OpenNewSession();
            IObjectSet          allItems = session.Query(typeof(CommitAfterDroppedFieldIndexTestCase.Item
                                                                ));

            for (IEnumerator itemIter = allItems.GetEnumerator(); itemIter.MoveNext();)
            {
                CommitAfterDroppedFieldIndexTestCase.Item item = ((CommitAfterDroppedFieldIndexTestCase.Item
                                                                   )itemIter.Current);
                item._id++;
                session.Store(item);
            }
            // Making sure all storing has been processed.
            session.SetSemaphore("anySemaphore", 0);
            storedField.DropIndex();
            session.Commit();
            storedField.CreateIndex();
        }
Exemplo n.º 2
0
        public virtual void TestCreateIndexAtRuntime()
        {
            IStoredField field = StoredField();

            Assert.IsFalse(field.HasIndex());
            field.CreateIndex();
            Assert.IsTrue(field.HasIndex());
            AssertQuery();
            field.CreateIndex();
        }
Exemplo n.º 3
0
        public virtual void TestDropIndex()
        {
            IStoredField field = StoredField();

            field.CreateIndex();
            AssertQuery();
            field.DropIndex();
            Assert.IsFalse(field.HasIndex());
            AssertQuery();
        }
			private static void ReindexDateTimeField(IStoredField field)
			{
				IReflectClass claxx = field.GetStoredType();
				if (claxx == null)
				{
					return;
				}

				Type t = NetReflector.ToNative(claxx);
				if (t == typeof(DateTime) || t == typeof(DateTime?))
				{
					field.DropIndex();
					field.CreateIndex();
				}
			}
Exemplo n.º 5
0
        private static void ReindexDateTimeField(IStoredField field)
        {
            var claxx = field.GetStoredType();

            if (claxx == null)
            {
                return;
            }

            var t = NetReflector.ToNative(claxx);

            if (t == typeof(T) || t == typeof(T?))
            {
                field.DropIndex();
                field.CreateIndex();
            }
        }