我添加了一個簡單的字段內容部分果園CMS內容的一部分,現場被添加兩次,不能刪除
ContentDefinitionManager.AlterPartDefinition("CarouselContentPart", b =>
b
.WithField("AutoPlay", cfg =>
cfg.OfType("NumericField")
.WithSetting("NumericFieldSettings.Hint", "Enter a value in milliseconds for autoplay (leave blank for no autoplay)")
.WithSetting("NumericFieldSettings.Required", "false")
.WithDisplayName("Autoplay"))
);
return 18;
它得到補充兩次,現在我無法將其刪除,或者通過其他的遷移或通過後臺。這是堆棧跟蹤
發生未處理的異常並且請求已終止。請刷新頁面。如果錯誤仍然存在,請返回 序列包含多個匹配元素 System.InvalidOperationException:序列在Orchard.ContentManagement.MetaData中的System.Linq.Enumerable.SingleOrDefault [TSource](IEnumerable
1 source, Func
2謂詞)包含多個匹配元素.Builders.ContentPartDefinitionBuilder.RemoveField(String fieldName)在C:\ Development \ FE-Corporate \ src \ Orchard \ ContentManagement \ MetaData \ Builders \ ContentPartDefinitionBuilder.cs中:第46行Orchard.ContentTypes.Services.ContentDefinitionService。 <> c__DisplayClass48.b__47(ContentPartDefinitionBuilder typeBuilder)在Orchard.ContentManagement.MetaData.ContentDefinitionManagerExtensions.AlterPartDefinition(IContentDefinitionManager經理,字符串名稱,動作1 alteration) in C:\Development\FE-Corporate\src\Orchard\ContentManagement\MetaData\IContentDefinitionManager.cs:line 32 at Orchard.ContentTypes.Services.ContentDefinitionService.RemoveFieldFromPart(String fieldName, String partName) at Orchard.ContentTypes.Controllers.AdminController.RemoveFieldFromPOST(String id) at lambda_method(Closure , ControllerBase , Object[]) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2參數)在System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary的2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult)在System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)at System.Web.Mvc.Async。在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters的AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d()<> c__DisplayClass46.b__3f> c__DisplayClass46.b__3f()在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters。 <> c__DisplayClass46.b__3f()在System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters。 <> c__DisplayClass46.b__3f()
貌似代碼期望只有一個字段,不能與多個工作。我想你唯一的選擇是從字段附加的數據庫中刪除一些記錄 – devqon