C# 更新到2.5.5.2700后出现RavenDB日期时间错误

C# 更新到2.5.5.2700后出现RavenDB日期时间错误,c#,asp.net,.net,ravendb,C#,Asp.net,.net,Ravendb,更新到最新的RavenDB后,我收到以下错误: [InvalidCastException:无法将类型为“Index_Auto_2fDocuments_2fByCreationDateTime和PublishTimes或ByCreationDateTimePublishTime”的对象强制转换为类型为“Raven.Database.Linq.AbstractViewGenerator”。] c:\Builds\RavenDB Stable\Raven.Database\Linq\DynamicV

更新到最新的RavenDB后,我收到以下错误:

[InvalidCastException:无法将类型为“Index_Auto_2fDocuments_2fByCreationDateTime和PublishTimes或ByCreationDateTimePublishTime”的对象强制转换为类型为“Raven.Database.Linq.AbstractViewGenerator”。] c:\Builds\RavenDB Stable\Raven.Database\Linq\DynamicViewCompiler.cs:598中的Raven.Database.Linq.DynamicViewCompiler.GenerateInstance()文件 c:\Builds\RavenDB Stable\Raven.Database\Storage\IndexDefinitionStorage.AddAndCompileIndex(IndexDefinition IndexDefinition)中的Raven.Database.Storage.IndexDefinitionStorage.cs:233 c:\Builds\RavenDB Stable\Raven.Database\DocumentDatabase.cs:1207中的Raven.Database.DocumentDatabase.PutIndex(字符串名称,索引定义) c:\Builds\RavenDB Stable\Raven.Database\querys\DynamicQueryRunner.CreateAutoIndex(字符串permanentIndexName,Func
1 createDefinition)中的Raven.Database.querys.DynamicQueryRunner.CreateAutoIndex(字符串permanentIndexName,Func
1 createDefinition):170
c:\Builds\RavenDB Stable\Raven.Database\querys\DynamicQueryRunner.getpropertiedIndexToquery(字符串entityName、IndexQuery查询、DynamicQueryMapping映射)中的Raven.Database.querys
c:\Builds\RavenDB Stable\Raven.Database\querys\DynamicQueryRunner.cs:32中的Raven.Database.querys.DynamicQueryRunner.ExecuteDynamicQuery(字符串entityName,索引查询查询)
c:\Builds\RavenDB Stable\Raven.Client.Embedded\EmbeddedDatabaseCommands.Query(字符串索引,IndexQuery查询,字符串[]包含,布尔元数据仅,布尔索引仅限EntriesOnly)中的Raven.Client.Embedded.EmbeddedDatabaseCommands.Query(字符串索引,IndexQuery查询,字符串[]包含,布尔元数据,布尔indexEntriesOnly)
c:\Builds\RavenDB Stable\Raven.Client.Lightweight\Document\AbstractDocumentQuery.cs:664中的Raven.Client.Document.AbstractDocumentQuery
2.ExecuteActualQuery() Raven.Client.Document.AbstractDocumentQuery
2.get\u QueryResult()在c:\Builds\RavenDB Stable\Raven.Client.Lightweight\Document\AbstractDocumentQuery.cs:633中
c:\Builds\RavenDB Stable\Raven.Client.Lightweight\Linq\ravenkeryProviderProcessor.cs:1499中的Raven.Client.Linq.ravenkeryProviderProcessor
1.ExecuteQuery() c:\Builds\RavenDB Stable\Raven.Client.Lightweight\Linq\RavenQueryInspector.cs:105中的Raven.Client.Linq.RavenQueryInspector
1.GetEnumerator()
System.Collections.Generic.List
1..ctor(IEnumerable
1 collection)+446
System.Linq.Enumerable.ToList(IEnumerable
1源代码)+80 c:\Dev\Repos\Git\Writer\Kernel\DocumentRavenProvider.cs:85中的Kernel.DocumentRavenProvider.GetDocuments(Int32计数) c:\Dev\Repos\Git\Writer\Kernel\DocumentManager.cs:46中的Kernel.DocumentManager.GetDocuments(Int32计数) c:\Dev\Repos\Git\Writer\Blog\Controllers\DocumentController.cs:18中的Blog.Controllers.DocumentController.Index() lambda_方法(闭包、控制器基、对象[])+79 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext ControllerContext,IDictionary
2参数)+261
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext ControllerContext,ActionDescriptor ActionDescriptor,IDictionary
2个参数)+39 System.Web.Mvc.Async.c_DisplayClass42.b_41()+34 System.Web.Mvc.Async.c_DisplayClass39.b_33()+124 System.Web.Mvc.Async.c_DisplayClass4f.b_49()+838923 System.Web.Mvc.Async.c_DisplayClass37.b_36(IAsyncResult asyncResult)+15 System.Web.Mvc.Async.c_DisplayClass2a.b_20()+33 System.Web.Mvc.Async.c_DisplayClass25.b_22(IAsyncResult asyncResult)+839508 System.Web.Mvc.c_displayClassId.b_18(IAsyncResult asyncResult)+28 System.Web.Mvc.Async.c_DisplayClass4.b_3(IAsyncResult ar)+15 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+65 System.Web.Mvc.Async.c_DisplayClass4.b_3(IAsyncResult ar)+15 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)+51 System.Web.Mvc.c_DisplayClass8.b_3(IAsyncResult asyncResult)+42 System.Web.Mvc.Async.c_DisplayClass4.b_3(IAsyncResult ar)+15 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+51 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+606 System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+288

执行此查询时

documents = session.Query<Model.Document>().Where(d => d.PublishTime <= DateTime.Now)
.OrderByDescending(document=>document.CreationDateTime).Take(count)
documents=session.Query().Where(d=>d.PublishTime document.CreationDateTime).Take(计数)
我正在运行一个嵌入式数据库,我已经尝试

  • 删除数据库并重新启动asp.net应用程序相同错误
  • 向数据库中添加一些内容,然后重新启动并加载asp.net应用程序相同错误
  • 在更新之前,一切正常。我有很多单元测试,其中我针对inmemory Raven数据库进行测试。这里的保存和检索工作正常,所以可能与正在解析的json有关

    我有一个调用底层RavenDB保存逻辑的控制器:

    // POST api/document
            public async System.Threading.Tasks.Task<Model.Document> Post([FromBody]Model.Document document)
            {
                var savedDocument = await _documentManager.Save(document);
    
                var hubConnection = new Microsoft.AspNet.SignalR.Client.Hubs.HubConnection(BaseSiteUrl);
                var hub = hubConnection.CreateHubProxy("DocumentHub");
                hubConnection.Start().Wait();
                hub.Invoke("NewArticle", savedDocument.Id).Wait();
    
                return document;
            }
    
    //发布api/文档
    public async System.Threading.Tasks.Task Post([FromBody]Model.Document)
    {
    var savedDocument=wait_documentManager.Save(文档);
    var hubConnection=new Microsoft.AspNet.signal.Client.Hubs.hubConnection(BaseSiteUrl);
    var hub=hubConnection.createhubbroxy(“DocumentHub”);
    hubConnection.Start().Wait();
    Invoke(“NewArticle”,savedDocument.Id).Wait();
    归还文件;
    }
    
    我的模型看起来像这样

        public class Document
        {
            public int Id { get; set; }
            public string Headline { get; set; }
            public string Text { get; set; }
            public DateTime CreationDateTime { get; set; }
            public DateTime PublishTime { get; set; }
            public HashSet<string> Tags { get; private set; }
            public int CategoryId { get; set; }
    
            [Raven.Imports.Newtonsoft.Json.JsonIgnore]
            public Model.Category Category { get; private set; }
    
            public Document()
            {
                CreationDateTime = DateTime.Now;
                Tags = new HashSet<string>();
            }
    
            public Document(string headline, string text, DateTime creationTime, DateTime publishTime)
            {
                Headline = headline;
                Text = text;
                CreationDateTime = creationTime;
                PublishTime = publishTime;
                Tags = new HashSet<string>();
            }
    
            public string GetCategoryName()
            {
                string name = String.Empty;
    
                if (this.Category != null)
                {
                    name = this.Category.Name;
                }
    
                return name;
            }
    
            public void SetCategory(Model.Category category)
            {
                if (category != null)
                {
                    this.Category = category;
                    this.CategoryId = category.Id;
                }
            }
    
            public string GetTeaser()
            {
                string teaser = Text;
                if (Text.Count() > 250)
                    teaser = Text.Substring(0, 250) + " ...";
    
                return teaser;
            }
    
            public string GetCommaSeperatedTagsString()
            {
                var tags = new StringBuilder();
    
                int i = 0;
                foreach (string tag in Tags)
                {
                    if (!String.IsNullOrEmpty(tag))
                    {
                        tags.Append(tag);
    
                        if (i < Tags.Count - 1)
                        {
                            tags.Append(",");
                        }
                    }
                    i++;
    
                }
    
                return tags.ToString();
            }
    
            public string GetSpaceSeperatedTagsString()
            {
                var tags = new StringBuilder();
    
                int i = 0;
                foreach (string tag in Tags)
                {
                    if (!String.IsNullOrEmpty(tag))
                    {
                        tags.Append(tag);
    
                        if (i < Tags.Count - 1)
                        {
                            tags.Append(" ");
                        }
                    }
                    i++;
    
                }
    
                return tags.ToString();
            }
    
            public void AddTagsString(string tagsString)
            {
                string[] tagsSplitted = tagsString.Split(',');
    
                foreach (var tag in tagsSplitted)
                {
                    if (!String.IsNullOrEmpty(tag))
                    {
                        Tags.Add(tag);
                    }
                }
            }
    
            public string GetTimeString()
            {
                System.TimeSpan span = DateTime.Now.Subtract(this.CreationDateTime);
                string time = "lige udgivet";
    
                if (span.Days > 0)
                {
                    if (span.Days > 1)
                        time = span.Days + " dage siden";
                    else
                        time = "en dag siden";
                }
    
                else if (span.Hours > 0)
                {
                    if (span.Hours > 1)
                        time = span.Hours + " timer siden";
                    else
                        time = "en time siden";
                }
    
                else if (span.Minutes > 0)
                {
                    if (span.Minutes > 1)
                        time = span.Minutes + " minutter siden.";
                    else
                        time = "et minut siden.";
                }
    
                else if (span.Seconds > 0)
                {
                    time = "lige udgivet";
                }
                else if (span.Milliseconds > 0)
                {
                    time = "lige udgivet";
                }
    
                return time;
            }
        }
    
    public class Category
                {
                    public string Name { get; set; }
                    public int Id { get; set; }
                }
    
    公共类文档
    {
    公共int Id{get;set;}
    公共字符串标题{get;set;}
    公共字符串文本{get;set;}
    公共日期时间CreationDateTime{get;set;}
    公共日期时间PublishTime{get;set;}
    公共HashSet标记{get;private set;}
    public int CategoryId{get;set;}
    [Raven.Imports.Newtonsoft.Json.JsonIgnore]
    公共模型.类别{get;priv