每当我保存对屏幕的更改时,都会显示此错误。我正在做的最后一件事是在WCF RIA服务中创建关系。我已经查看了所有异常信息,并试图在调试器中将代码单步调试,但没有任何结果。 'name'引用是没用的,我评论了引用'name'的每一段代码。它似乎是其中一个例外,它几乎没有告诉你这个问题。
[Microsoft.LightSwitch.DataService][Application:Error][LightSwitchServiceApplication.WCF_RIA_ServiceData:SaveChanges] An exception has occurred: Microsoft.LightSwitch.DataServiceOperationException: Invalid argument 'name' ---> System.ArgumentException: Invalid argument 'name'
at Microsoft.LightSwitch.Platform.Utilities.Internal.Parameter.ThrowArgumentException(String parameterName)
at Microsoft.LightSwitch.Details.Framework.Base.DetailsSet`3.GetItemCore(String name)
at Microsoft.LightSwitch.Details.Framework.Base.DetailsSet`1.get_Item(String name)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.RiaDataProvider.HandleErrors(ChangeSet changeSet, List`1 entityPairs)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.RiaDataProvider.SubmitCore(IEnumerable`1 changes)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.DataProvider.Submit(IEnumerable`1 changes)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersistCore(IEnumerable`1 eventsChangeSetItems)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.<>c__DisplayClass46.<PerformPersist>b__45()
at Microsoft.LightSwitch.Threading.DualDispatcherObject.Mutate(IDispatcher logicDispatcher, MutatorHost host, Action mutator)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersist(IEnumerable`1 eventsChangeSetItems)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.Submit()
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataService`1.<>c__DisplayClass12.<Microsoft.LightSwitch.ServerGenerated.Implementation.IODataService.SaveChanges>b__10()
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.InvokeOperationCore[T](String operationName, Object[] args, Boolean invokedFromODataClient, Func`1 invokeOperation, Action catchCallback, Action`2 serializeCustomExceptionInfo)
--- End of inner exception stack trace ---
答案 0 :(得分:1)
如果您在WCF RIA Services类中使用nullable属性,在LightSwitch中更新数据源,并在RIA Services中将然后标记为[Required]
,则会出现此运行时错误
必需在LightSwitch中强制 1到多个(在我的情况下)关系,并且在RIA Services中使用可空类型会给出一个语法错误,即在可空类型之间没有隐式转换(RIA)服务)及其不可空的等价物(LightSwitch)。
但是,如果您创建可空类型 first ,LightSwitch将创建 0或1到多个关系,然后当您添加必需时对于RIA Services,这个模糊的运行时异常被抛出。