0

ドキュメントの 2 つのフィールド (TraceRowID、LoadDate) を含む単純なインデックスを作成しようとしています。

そこで、次のクラスを作成しました。

using Model;
using Raven.Abstractions.Indexing;
using Raven.Client.Indexes;
using Raven.Client.Linq;
using Raven.Client.Document;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Indexes
{
    public class IDLoadDateIndex : AbstractIndexCreationTask<ServiceTrace>
    {
        public IDLoadDateIndex()
        {
            Map = serviceTrace => from st in serviceTrace
                                  select new { ID = st.TraceRowID, LoadDate = st.LoadDate };
        }
    }
}

私のモデルは「ServiceTrace」です:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    public class ServiceTrace
    {
        public int TraceRowID { get; set; }
        public string StatusDescription { get; set; }
        public string FullExceptionText { get; set; }
        public string LoadDate { get; set; }
    }
}

そして、私のDALがあります:

using Indexes;
using Raven.Client.Indexes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class DbConnection
    {
        private readonly static DbConnection instance = new DbConnection();
        private Raven.Client.Document.DocumentStore documentStore;

        static DbConnection()
        {
        }

        private DbConnection()
        {
            this.documentStore = new Raven.Client.Document.DocumentStore { Url = "http://btadmins:8080/" };            
            this.documentStore.Initialize();
            IndexCreation.CreateIndexes(typeof(IDLoadDateIndex).Assembly, this.documentStore);
        }

        public static DbConnection Instance
        {
            get
            {
                return instance;
            }
        }

        public Raven.Client.Document.DocumentStore DocumentStore
        {
            get
            {
                return documentStore;
            }
        }
    }
}

何らかの理由で、「CreateIndexes」行でデバッグ モードにステップ オーバーすると、正常に実行されます。しかし、RavenDB 管理スタジオの Silverlight アプリにインデックスが追加されていません。何が問題になる可能性がありますか?

4

1 に答える 1