public async Task <CrmFunctionParameterHandleResult> Convert(string name, object parameter) { CrmFunctionParameterHandleResult result; if (parameter == null) { result = new CrmFunctionParameterHandleResult(); result.Name = name; result.Value = "null"; return(await Task.FromResult(result)); } if (!_handleFactories.TryGetValue(parameter.GetType(), out IFactory <ICrmFunctionParameterHandle> handleFactory)) { var fragment = new TextFragment() { Code = TextCodes.NotFoundCrmFunctionParameterHandleByType, DefaultFormatting = "找不到类型为{0}的Crm函数参数处理,发生位置:{1}", ReplaceParameters = new List <object>() { parameter.GetType().FullName, $"{ this.GetType().FullName }.Convert" } }; throw new UtilityException((int)Errors.NotFoundCrmFunctionParameterHandleByType, fragment); } return(await handleFactory.Create().Convert(name, parameter)); }
public async Task <CrmFunctionParameterHandleResult> Convert(string name, object parameter) { CrmFunctionParameterHandleResult result = new CrmFunctionParameterHandleResult(); result.Name = name; result.Value = $"'{parameter.ToString()}'"; return(await Task.FromResult(result)); }
public async Task <CrmFunctionParameterHandleResult> Convert(string name, object parameter) { var realparameter = (CrmFunctionEnumTypeParameter)parameter; CrmFunctionParameterHandleResult result = new CrmFunctionParameterHandleResult(); result.Name = name; result.Value = $"Microsoft.Dynamics.CRM.{realparameter.Name}'{realparameter.Value}'"; return(await Task.FromResult(result)); }
public async Task <CrmFunctionParameterHandleResult> Convert(string name, object parameter) { var parameterReference = (CrmEntityReference)parameter; CrmFunctionParameterHandleResult result = new CrmFunctionParameterHandleResult(); result.Name = name; result.Value = $"{{'@odata.id':'{parameterReference.EntityName.ToPlural()}({parameterReference.Id.ToString()})'}}"; return(await Task.FromResult(result)); }
public async Task <CrmFunctionParameterHandleResult> Convert(string name, object parameter) { var parameterReference = (CrmEntityReferenceNull)parameter; CrmFunctionParameterHandleResult result = new CrmFunctionParameterHandleResult(); result.Name = name; result.Value = $"{{'@odata.id':null}}"; return(await Task.FromResult(result)); }