我在我的自定义工作流代码中创建了一个模型属性,生成了代码的程序集。然后,我已经厌倦了使用插件注册工具注册程序集文件,但在完成时收到如下错误消息 - 不支持属性模型的 Int32 类型。(插件注册工具是否支持64位int类型,如果那么如何将我粘贴在底部的代码中的int32更改为int64)
未处理的异常:System.Web.Services.Protocols.SoapException:服务器无法处理请求。详细信息:
0x8004501d
不支持属性模型的 Int32 类型。在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) 在 PluginRegistrationTool 的 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) 的平台。 CrmSdk.CrmService.Create(BusinessEntity entity) at PluginRegistrationTool.RegistrationHelper.RegisterPluginType(CrmOrganization org, CrmPlugin plugin) at PluginRegistrationTool.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)
如果我做错了什么,请参考下面的代码并纠正我。
[CrmWorkflowActivity("Create Cardetails Record", "Utilities")]
public partial class CreateCardetails : SequenceActivity
{
public static DependencyProperty modelProperty = DependencyProperty.Register("model", typeof(int), typeof(CreateCardetails));
[CrmInput("Model")]
public int model
{
get
{
return (int)base.GetValue(modelProperty);
}
set
{
base.SetValue(modelProperty, value);
}
}
public CreateCardetails()
{
InitializeComponent();
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
// Get the context service.
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext context = contextService.Context;
// Use the context service to create an instance of CrmService.
ICrmService crmService = context.CreateCrmService(true);
DynamicEntity entity = null;
Guid contactId;
if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity)
{
// Obtain the target business entity from the input parmameters.
entity = (DynamicEntity)context.InputParameters.Properties["Target"];
contactId = ((Key)entity.Properties["contactid"]).Value;
Lookup lookup = new Lookup();
lookup.Value = contactId;
lookup.type = "contact";
//Create an account which is linked to the contact record
DynamicEntity cardetails = new DynamicEntity("cir_cardetails");
cardetails["cir_carsdetailsid"] = lookup;
//Setting the picklist value of Model
Picklist modelPickList = new Picklist();
modelPickList.Value = (int)model;
cardetails.Properties.Add(new PicklistProperty("cir_model", modelPickList));
Guid carkey = crmService.Create(cardetails);
}
return ActivityExecutionStatus.Closed;
}
}
请帮助,我所有的运气现在都没有了。我不知道如何解决它,甚至不确定这个问题。