有没有办法将字符串转换为表达式?
我的字符串: var1 == null && var2 != 5
我想使用这个字符串作为if(),喜欢的条件if(var1 == null && var2 != 5)
我已经为我们的报价产品注册了一个插件.该插件在我们的测试环境中运行良好.我已经测试了很多次.然后在主服务器中注册该插件.但是,会出现以下情况:当我首先创建或更新报价产品时,报价产品表格会变灰:

点击报价表后,出现错误.没有可用的日志文件(如您所见).我调试了插件,但也没有错误.单击"确定"后,错误消失,所需业务发生在报价产品上(对于税收字段).意味着插件代码没有错误并且工作得很好.代码如下:
using System;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Xrm;
using System.Collections.Generic;
using Microsoft.Xrm.Sdk.Deployment;
public class Plugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
Entity entity;
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName != "quotedetail") { return; }
}
else
{
return;
}
try
{
IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(
typeof(IOrganizationServiceFactory));
IOrganizationService service =
serviceFactory.CreateOrganizationService(context.UserId);
if (context.MessageName == "Create")
{
Entity QuoteProduct = (Entity)context.InputParameters["Target"];
Guid QPID …Run Code Online (Sandbox Code Playgroud)