本文整理汇总了C#中Configuration.BuildAssemblers方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.BuildAssemblers方法的具体用法?C# Configuration.BuildAssemblers怎么用?C# Configuration.BuildAssemblers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.BuildAssemblers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeGen
public void CodeGen()
{
Configuration cfg = new Configuration();
cfg.AddAssemblyResources(Assembly.GetAssembly(typeof(DerivedXmlUserDTO)), "otis.xml");
cfg.GenerationOptions.OutputType = OutputType.SourceCode;
cfg.GenerationOptions.OutputFile = "nixonAssembler.cs";
cfg.BuildAssemblers();
}
示例2: Recognize_External_Assemblies_For_Base_Class
public void Recognize_External_Assemblies_For_Base_Class()
{
Configuration cfg = new Configuration();
//cfg.AddAssemblyReference("nunit.core.dll"); not needed, but can be done
//cfg.AddAssemblyReference("nunit.framework.dll");
cfg.AddType<ExternalDependency>();
cfg.BuildAssemblers();
}
示例3: Recognize_External_Assemblies_For_Implemented_Interfaces
public void Recognize_External_Assemblies_For_Implemented_Interfaces()
{
Configuration cfg = new Configuration();
cfg.AddType<ExternalDependency2>();
cfg.BuildAssemblers();
}
示例4: Setup
public void Setup()
{
Configuration cfg;
cfg = new Configuration();
cfg.AddType<UserDTO>();
cfg.AddType<ProjectDTO>(); // todo: should this be automatically detected
cfg.AddType<DocumentDTO>(); // todo: should this be automatically detected
cfg.AddType<TaskDTO>(); // todo: should this be automatically detected
cfg.BuildAssemblers();
m_assembler = cfg.GetAssembler<UserDTO, User>();
m_user = Helpers.CreateComplexUser();
}
示例5: Compilation_Fails_With_Invalid_Mapping_Expression
public void Compilation_Fails_With_Invalid_Mapping_Expression()
{
Configuration cfg = new Configuration();
cfg.AddType<InvalidDTO>();
cfg.BuildAssemblers();
}
示例6: GenerateOtisMapping
//private static void Test001()
//{
// CLIS2015U04GetProtocolItemArgs args = new CLIS2015U04GetProtocolItemArgs();
// CLIS2015U04GetProtocolItemResult result = CloudService.Instance.Submit<CLIS2015U04GetProtocolItemResult, CLIS2015U04GetProtocolItemArgs>(args);
//}
//private static void Test002()
//{
// List<CloudConnector.Contracts.Models.Bass.BAS0212U00GrdItemInfo> inputList = new List<CloudConnector.Contracts.Models.Bass.BAS0212U00GrdItemInfo>();
// BAS0212U00TransactionalArgs args = new BAS0212U00TransactionalArgs(inputList, "1");
// UpdateResult result = CloudService.Instance.Submit<UpdateResult, BAS0212U00TransactionalArgs>(args);
//}
private static void GenerateOtisMapping()
{
Configuration _cfg = new Configuration();
_cfg.GenerationOptions.Namespace = "IHIS.CloudConnector";
_cfg.GenerationOptions.OutputFile = Application.StartupPath + "..\\..\\..\\Mappings\\Assembler.cs";
_cfg.GenerationOptions.OutputType = OutputType.SourceCode;
_cfg.GenerationOptions.MOneFilePerClass = true;
_cfg.AddAssemblyResources(Assembly.GetExecutingAssembly(), "otis.xml");
_cfg.BuildAssemblers();
}
示例7: ComparePerformance
//[Test]
public void ComparePerformance()
{
User user = Helpers.CreateComplexUser();
// add more tasks
user.Projects[0].Tasks.Add(new Task(5));
user.Projects[0].Tasks.Add(new Task(4));
user.Projects[0].Tasks.Add(new Task(2));
user.Projects[0].Tasks.Add(new Task(6));
user.Projects[0].Tasks.Add(new Task(4));
user.Projects[0].Tasks.Add(new Task(2));
user.Projects[1].Tasks.Add(new Task(3));
user.Projects[1].Tasks.Add(new Task(4));
user.Projects[1].Tasks.Add(new Task(5));
user.Projects[1].Tasks.Add(new Task(1));
user.Projects[1].Tasks.Add(new Task(4));
user.Projects[0].Tasks.Add(new Task(5));
user.Projects[0].Tasks.Add(new Task(4));
user.Projects[0].Tasks.Add(new Task(2));
user.Projects[0].Tasks.Add(new Task(6));
user.Projects[0].Tasks.Add(new Task(4));
user.Projects[0].Tasks.Add(new Task(2));
user.Projects[1].Tasks.Add(new Task(3));
user.Projects[1].Tasks.Add(new Task(4));
user.Projects[1].Tasks.Add(new Task(5));
user.Projects[1].Tasks.Add(new Task(1));
user.Projects[1].Tasks.Add(new Task(4));
UserDTO dto = new UserDTO();
Configuration cfg;
cfg = new Configuration();
cfg.AddType(typeof(UserDTO));
cfg.AddType(typeof(ProjectDTO)); // todo: should this be automatically detected
cfg.AddType(typeof(DocumentDTO)); // todo: should this be automatically detected
cfg.AddType(typeof(TaskDTO)); // todo: should this be automatically detected
cfg.BuildAssemblers();
IAssembler<UserDTO, User> assembler = cfg.GetAssembler<UserDTO, User>();
assembler.Assemble(ref dto, ref user); // run it once
long time = Environment.TickCount;
for(int i = 0; i < ITER_COUNT; i++)
{
assembler.Assemble(ref dto, ref user);
}
long time1 = Environment.TickCount - time;
Console.Out.WriteLine("Generated assembler timing = {0}", time1);
Assemble(dto, user); // run it once
time = Environment.TickCount;
for (int i = 0; i < ITER_COUNT; i++)
{
Assemble(dto, user);
}
long time2 = Environment.TickCount - time;
Console.Out.WriteLine("Manual assembler timing = {0}", time2);
Console.Out.WriteLine("Ratio = {0}", time1/(double)time2);
}