none
关于跟BusinessUnit添加一个扩展表BusinessUnitExtensionBase RRS feed

  • 问题

  • 我在CRM系统里添加拉一张BusinessUnitExtensionBase,修改metadataschema.entity 这表里BusinessUnit的IsCustomizable改为true和ExtensionTableName改为BusinessUnitExtensionBase,
    这样修改后我在BusinessUnit添加拉两个负责人.但在保存记录的时候出现错误.
    at BusinessProcessObject.ExecuteNonQuery(IDbCommand command, ISqlExecutionContext context)
    at BusinessProcessObject.DoUpdate(IBusinessEntity entity, FilterExpression filter, ExecutionContext context)
    at BusinessUnitService.Microsoft.Crm.Sdk.IUpdatable.DoUpdate(IBusinessEntity , FilterExpression , ExecutionContext )
    at RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at LogicalMethodInfo.Invoke(Object target, Object[] values)
    at InternalOperationPlugin.Execute(IPluginExecutionContext context)
    at PluginStep.Execute(PipelineExecutionContext context)
    at Pipeline.Execute(PipelineExecutionContext context)
    at MessageProcessor.Execute(PipelineExecutionContext context)
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)
    at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)
    at ExtensiblePlatformMessageDispatcher.Update(BusinessEntity entity, FilterExpression filter, ExecutionContext context)
    at BusinessProcessObject.UpdateWithPipeline(IBusinessEntity entity, FilterExpression filter, ExecutionContext context)
    at BusinessProcessObject.Update(IBusinessEntity entity, ExecutionContext context)
    at RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at LogicalMethodInfo.Invoke(Object target, Object[] values)
    at InternalOperationPlugin.Execute(IPluginExecutionContext context)
    at PluginStep.Execute(PipelineExecutionContext context)
    at Pipeline.Execute(PipelineExecutionContext context)
    at MessageProcessor.Execute(PipelineExecutionContext context)
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)
    at ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
    at RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
    at RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
    at CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
    at InProcessCrmService.Execute(Object request)
    at PlatformCommand.ExecuteInternal()
    at UpdateCommand.Execute()
    at EntityProxy.Update(Boolean performDuplicateCheck)
    at AppForm.SaveEntity(EntityProxy entity, FormEventId eventType, String redirectPath, Boolean performDuplicateCheck)
    at AppForm.RaiseDataEvent(FormEventId eventId)
    at EndUserForm.Initialize(Entity entity)
    at CustomizableForm.Execute(Entity entity, String formType)
    at CustomizableForm.Execute(Entity entity)
    at BusinessDetailPage.ConfigureForm()
    at AppUIPage.OnPreRender(EventArgs e)
    at Control.PreRenderRecursiveInternal()
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at Page.ProcessRequest()
    at Page.ProcessRequestWithNoAssert(HttpContext context)
    at Page.ProcessRequest(HttpContext context)
    at ecscrmtest_biz_business_edit_aspx.ProcessRequest(HttpContext context)
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    at HttpApplication.ResumeSteps(Exception error)
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
    at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
    >Exception when executing non-query: update BusinessUnitBase set ModifiedOn='08/26/2009 09:20:00', ModifiedBy='6955b218-2a87-de11-90f1-001e0bd79e1c' where (BusinessUnitId = '05aa8c65-2192-de11-ad65-001e0bd79e1c');update  set new_unitmanager='6955b218-2a87-de11-90f1-001e0bd79e1c', new_unitmanager2='6955b218-2a87-de11-90f1-001e0bd79e1c' where (BusinessUnitId = '05aa8c65-2192-de11-ad65-001e0bd79e1c') Exception: System.Data.SqlClient.SqlException: 关键字 'set' 附近有语法错误。
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
    at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
    at Microsoft.Crm.CrmDbConnection.InternalExecuteNonQuery(IDbCommand command)
    at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command, Boolean impersonate)
    at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command)
    at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteNonQuery(IDbCommand command, ISqlExecutionContext context)
    好像是
    update  set new_unitmanager='6955b218-2a87-de11-90f1-001e0bd79e1c', new_unitmanager2='6955b218-2a87-de11-90f1-001e0bd79e1c' where (BusinessUnitId = '05aa8c65-2192-de11-ad65-001e0bd79e1c')
    缺少BusinessUnitExtensionBase
    2009年8月26日 9:26

答案

全部回复