我一直在使用引用 Dynamics CRM 租户的旧程序集。该程序集包含(除其他外)租户的代理类。我需要将代理类更新到最新版本。
我过去曾使用 crmsvcutil.exe 为租户生成代理类文件,但在这个程序集中,每个类都在自己单独的文件中。例如,有一个“person”c-sharp 文件,其中包含 person 实体的变量和 get/set 方法。
当前文件格式如下:
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
namespace CRM2011.Proxy.Organisation
{
[GeneratedCode("System.Xml", "4.0.30319.1"), DesignerCategory("code"), DebuggerStepThrough, XmlType(Namespace = "http://schemas.microsoft.com/crm/2007/WebServices")]
[Serializable]
public class thr_offer : BusinessEntity
{
private Lookup createdbyField;
private CrmDateTime createdonField;
//More variables here
public Lookup createdby
{
get
{
return this.createdbyField;
}
set
{
this.createdbyField = value;
}
}
public CrmDateTime createdon
{
get
{
return this.createdonField;
}
set
{
this.createdonField = value;
}
}
//More get/set methods here
}
这些似乎是由工具生成的,但我不知道有任何工具可以执行此操作。如果我可以生成诸如此类的文件,而不是 crmsvcutil.exe 生成的庞大文件,这将使开发变得更加容易。
有什么想法吗?
最佳答案
文件是使用 CRM 4.0 SDK 生成的(CrmDateTime
响铃)。
使用 CRM 4.0 SDK 中的 CrmSvcUtil.exe
可以生成单独的文件,如下所述:
http://msdn.microsoft.com/en-us/library/ff681563.aspx
/out parameter
Determines the name of the .cs or .xml output file and whether there is one file or one per entity. It may include a full path. If you specify a name that does not end with .cs or .xml, CrmSvcUtil will write an individual .cs file for every entity in the system to the folder you specify. For example, /out:MyClasses outputs a class file (.cs) for every entity to a folder called MyClasses.However, /out:MyClasses.cs outputs a class file (MyClasses.cs) that contains all entities.
此“功能”已从 CRM 2011 SDK 中删除(如果您尝试指定不带文件扩展名的名称,它仍会生成单个文件)
关于c# - 将 CRM 代理类生成为单独的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21544495/