-
Notifications
You must be signed in to change notification settings - Fork 5
Description
System.InvalidCastException: Unable to cast object of type 'SpiderService.Dto.Book' to type 'SpiderService.Dto.Books'.
at OpenRasta.Caching.Configuration.ResourceMapper`1.<>c__DisplayClass1.b__0(Object resource)
at OpenRasta.Caching.Pipeline.LastModifiedContributor.PostExecution(ICommunicationContext context)
at OpenRasta.Pipeline.PipelineRunner.ExecuteContributor(ICommunicationContext context, ContributorCall call)
This is happening when a given Handler is setup with more that one resources and endpoints.
Requests for /Book/WWW are handled but for /Books/ByCode/WWW throw above exception.
BookSearchHandler setup:
ResourceSpace.Has.ResourcesOfType()
.AtUri("/Books?codeLike={searchTerms}")
.And.AtUri("/Books/ByCode/{searchTerms}").Named("OpenSearch:Book search")
.HandledBy()
.TranscodedBy()
.Map().LastModified(x => new DateTimeOffset(DateTime.Now));
ResourceSpace.Has.ResourcesOfType<Book>()
.AtUri("/Book/{bookCode}")
.HandledBy<BookSearchHandler>()
.TranscodedBy<HtmlCodec>()
.Map<Book>().LastModified(x => new DateTimeOffset(DateTime.Now));