当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.GetAssembler方法代码示例

本文整理汇总了C#中Configuration.GetAssembler方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.GetAssembler方法的具体用法?C# Configuration.GetAssembler怎么用?C# Configuration.GetAssembler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration.GetAssembler方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAttributedAssembler

 public IAssembler<DerivedUserDTO, DerivedUser> CreateAttributedAssembler()
 {
     Configuration cfg = new Configuration();
     cfg.AddType(typeof(DerivedUserDTO));
     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
     return cfg.GetAssembler<DerivedUserDTO, DerivedUser>();
 }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:9,代码来源:InheritanceMappingTests.cs

示例2: Formatting_Works_For_User_Aggregates_Not_Derived_From_SimpleFunctionBase

        public void Formatting_Works_For_User_Aggregates_Not_Derived_From_SimpleFunctionBase()
        {
            Configuration cfg = new Configuration();
            cfg.RegisterFunction<MedianFn>("median");
            cfg.AddType(typeof(Dummy2));
            IAssembler<Dummy2, User> asm = cfg.GetAssembler<Dummy2, User>();
            Dummy2 dummy = asm.AssembleFrom(Helpers.CreateComplexUser());

            Assert.AreEqual("Median document length: 4.00 characters", dummy.MedianDocumentNameLengthInfo);
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:10,代码来源:ExpressionFormattingTests.cs

示例3: Formatting_Works_For_Aggregate_Expressions

        public void Formatting_Works_For_Aggregate_Expressions()
        {
            Configuration cfg = new Configuration();
            cfg.AddType(typeof(Dummy));
            IAssembler<Dummy, User> asm = cfg.GetAssembler<Dummy, User>();
            Dummy dummy = asm.AssembleFrom(Helpers.CreateComplexUser());

            Assert.AreEqual("2 documents", dummy.DocumentInfo);
            Assert.AreEqual("Avg document length: 4.00 characters", dummy.AvgDocumentNameLengthInfo);
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:10,代码来源:ExpressionFormattingTests.cs

示例4: SetUp

        public void SetUp()
        {
            Configuration cfg = new Configuration();
            cfg.AddType(typeof(AttributedUserDTO));
            m_assembler = cfg.GetAssembler<AttributedUserDTO, User>();
            m_source = new List<User>(3);
            m_source.Add(new User());
            m_source[0].FirstName = "Zdeslav";
            m_source[0].LastName = "Vojkovic";
            m_source[0].Age = 33;
            m_source[0].Id = 1;
            m_source[0].UserName = "zdeslavv";

            m_source.Add(Helpers.CreateComplexUser());
            m_source.Add(m_source[1].Boss);
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:16,代码来源:CollectionMappingTest.cs

示例5: 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();
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:15,代码来源:EntityMappingTest.cs

示例6: SetUpDefaults

 public void SetUpDefaults()
 {
     Configuration cfg = new Configuration();
     cfg.AddType<AttributedUserDTO>();
     m_asm = cfg.GetAssembler<AttributedUserDTO, User>();
     m_user = Helpers.CreateComplexUser();
 }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:7,代码来源:NullValueHandlingTests.cs

示例7: XmlMapping

        public void XmlMapping()
        {
            Configuration cfg = new Configuration();
            cfg.AddXmlString(xmlCfg);

            IAssembler<OrderDTO, Order> asm = cfg.GetAssembler<OrderDTO, Order>();
            Order user = GetDefaultOrder();
            /*	UserWithComponentsDTO dto = asm.AssembleFrom(user);
            Assert.That("X Y", Is.EqualTo(dto.FullName));
            Assert.That(1, Is.EqualTo(dto.Id));
            Assert.That("road to nowhere 1", Is.EqualTo(dto.Address.Street));
            Assert.That("Whatevertown", Is.EqualTo(dto.Address.City.CityName));
            Assert.That("12345", Is.EqualTo(dto.Address.City.ZipCode));	*/
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:14,代码来源:ComponentMappingTests.cs

示例8: CreateXmlAssembler

 public IAssembler<DerivedXmlUserDTO, DerivedUser> CreateXmlAssembler()
 {
     Configuration cfg = new Configuration();
     cfg.AddAssemblyResources(Assembly.GetAssembly(typeof(DerivedXmlUserDTO)),"otis.xml");
     return cfg.GetAssembler<DerivedXmlUserDTO, DerivedUser>();
 }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:6,代码来源:InheritanceMappingTests.cs

示例9: 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);
        }
开发者ID:varunkumarmnnit,项目名称:otis-lib,代码行数:64,代码来源:PerformanceTest.cs


注:本文中的Configuration.GetAssembler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。