微软动态 CRM 2015。
我测试了 Asp.Net Core 控制器的动作。当我创建新Lead
记录时,某些插件会为lead.new_master_id
字段生成新的 Guid(它的类型是string
)。因此,在创建后我检索记录以获取它的生成new_master_id
值。如何通过Fake Xrm Easy模拟此插件行为?
var fakedContext = new XrmFakedContext();
fakedContext.ProxyTypesAssembly = typeof(Lead).Assembly;
var entities = new Entity[]
{
// is empty array
};
fakedContext.Initialize(entities);
var orgService = fakedContext.GetOrganizationService();
var lead = new Lead { FirstName = "James", LastName = "Bond" };
var leadId = orgService.Create(lead);
var masterId = orgService.Retrieve(Lead.EntityLogicalName, leadId,
new Microsoft.Xrm.Sdk.Query.ColumnSet(Lead.Fields.new_master_id))
.ToEntity<Lead>().new_master_id;