I've created a widged with Orchard. Unfortunately I've used the same "Title" for a jPlayer widget twice. Now I receive an error:
Server Error in '/wgk' Application. Sequence contains more than one element Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains more than one element
Source Error:
Line 2: <fieldset>
Line 3: <div>@Html.LabelFor(o => o.MediaGalleryName, @T("Media gallery"))</div>
Line 4: @if(!Model.HasAvailableGalleries) {
Line 5: <div>@T("You need first to create an media gallery on Media Gallery menu")</div>
Line 6: }
Source File: x:\Intepub\wgk\Modules\Orchard.jPlayer\Views\EditorTemplates\Parts\MediaGallery.cshtml Line: 4
Stack Trace:
[InvalidOperationException: Sequence contains more than one element]
System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +4206966
NHibernate.Linq.Visitors.ImmediateResultsVisitor`1.HandleSingleOrDefaultCall(MethodCallExpression call) +51
NHibernate.Linq.Visitors.ImmediateResultsVisitor`1.VisitMethodCall(MethodCallExpression call) +411
NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp) +371
In MediaGallery.cshtml (found in error description above) is written:
@model Orchard.jPlayer.Models.MediaGalleryPart
<fieldset>
<div>@Html.LabelFor(o => o.MediaGalleryName, @T("Media gallery"))</div>
@if(!Model.HasAvailableGalleries) {
<div>@T("You need first to create an media gallery on Med开发者_JAVA技巧ia Gallery menu")</div>
}
else {
<div>@Html.DropDownListFor(o => o.SelectedGallery, Model.AvailableGalleries)</div>
<div>@Html.LabelFor(o => o.SelectedType, @T("Media gallery type"))</div>
<div>@Html.DropDownListFor(o => o.SelectedType, Model.AvailableTypes)</div>
<div>@Html.LabelFor(o => o.AutoPlay, @T("Auto play"))</div>
<div>@Html.CheckBoxFor(o => o.AutoPlay)</div>
}
</fieldset>
My problem is now, I cannot find or edit the widget with double used name. I would love to replace it to another name. But I do not know where to do this.
Please advice.
* SOLUTION *
I've deleted the last entry in database (SDF File). I've used this tool Primeworks mobile. Now it works for short time. After editing entries in jPlayer widget again it could occour same error again.
Try searching all tables named Orchard_jPlayer_XXX. One of those should have a duplicate value somewhere. Eg. column named Title exists in Orchard_jPlayer_MediaGalleryMediaSettingsRecord - it's a good starting point.
If you were setting the Title property of a widget - check Orchard_Widgets_WidgetPartRecord table also. If this is the case, my guess is you'll find the duplicate there.
HTH
There is something seriously wrong with this widget that should be communicated to its author (is it you?). The title should not be used like an identifier.
精彩评论