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


C# ExportContext.Register方法代码示例

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


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

示例1: CircularReferenceDetectionAcrossTypes

 public void CircularReferenceDetectionAcrossTypes()
 {
     ExportContext context = new ExportContext();
     ComponentExporter exporter = new ComponentExporter(typeof(Parent));
     context.Register(exporter);
     context.Register(new ComponentExporter(typeof(ParentChild)));
     Parent parent = new Parent();
     parent.Child = new ParentChild();
     parent.Child.Parent = parent;
     exporter.Export(context, parent, new EmptyJsonWriter());
 }
开发者ID:atifaziz,项目名称:Jayrock,代码行数:11,代码来源:TestComponentExporter.cs

示例2: TableExportedViaDataView

        public void TableExportedViaDataView()
        {
            DataTable table = new DataTable();

            ExportContext context = new ExportContext();
            TestDataViewExporter exporter = new TestDataViewExporter();
            context.Register(exporter);
            context.Export(table, new JsonRecorder());

            Assert.AreSame(table.DefaultView, exporter.LastExported);
        }
开发者ID:atifaziz,项目名称:Jayrock,代码行数:11,代码来源:TestDataTableExporter.cs

示例3: DeepCircularReferenceDetection

 public void DeepCircularReferenceDetection()
 {
     ExportContext context = new ExportContext();
     ComponentExporter exporter = new ComponentExporter(typeof(Thing));
     context.Register(exporter);
     Thing thing = new Thing();
     thing.Other = new Thing();
     thing.Other.Other = new Thing();
     thing.Other.Other.Other = thing;
     exporter.Export(context, thing, new EmptyJsonWriter());
 }
开发者ID:atifaziz,项目名称:Jayrock,代码行数:11,代码来源:TestComponentExporter.cs

示例4: TableExportedViaItsExporter

        public void TableExportedViaItsExporter()
        {
            DataSet ds = new DataSet();
            ds.Tables.Add(new DataTable("Table1"));

            ExportContext context = new ExportContext();
            TestDataTableExporter exporter = new TestDataTableExporter();
            context.Register(exporter);
            context.Export(ds, new JsonRecorder());

            Assert.AreSame(ds.Tables[0], exporter.LastExported);
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:12,代码来源:TestDataSetExporter.cs

示例5: MemberExportCustomization

        public void MemberExportCustomization()
        {
            ArrayList calls = new ArrayList();

            TestTypeDescriptor logicalType = new TestTypeDescriptor();
            PropertyDescriptorCollection properties = logicalType.GetProperties();

            Hashtable services;

            TestObjectMemberExporter memexp1 = new TestObjectMemberExporter(calls);
            services = new Hashtable();
            services.Add(typeof(IObjectMemberExporter), memexp1);
            properties.Add(new TestPropertyDescriptor("prop1", services));

            TestObjectMemberExporter memexp2 = new TestObjectMemberExporter(calls);
            services = new Hashtable();
            services.Add(typeof(IObjectMemberExporter), memexp2);
            properties.Add(new TestPropertyDescriptor("prop2", services));

            ComponentExporter exporter = new ComponentExporter(typeof(Thing), logicalType);
            ExportContext context = new ExportContext();
            context.Register(exporter);

            JsonRecorder writer = new JsonRecorder();
            Thing thing = new Thing();
            context.Export(thing, writer);

            Assert.AreEqual(2, calls.Count);

            object[] args = { context, writer, thing };

            Assert.AreSame(memexp1, calls[0]);
            Assert.AreEqual(args, ((TestObjectMemberExporter) calls[0]).ExportArgs);

            Assert.AreSame(memexp2, calls[1]);
            Assert.AreEqual(args, ((TestObjectMemberExporter) calls[1]).ExportArgs);
        }
开发者ID:atifaziz,项目名称:Jayrock,代码行数:37,代码来源:TestComponentExporter.cs

示例6: MemberExportCustomization

        public void MemberExportCustomization()
        {
            TestObjectMemberExporter memberExporter = new TestObjectMemberExporter();
            Hashtable services = new Hashtable();
            services.Add(typeof(IObjectMemberExporter), memberExporter);

            TestTypeDescriptor logicalType = new TestTypeDescriptor();
            PropertyDescriptorCollection properties = logicalType.GetProperties();
            properties.Add(new TestPropertyDescriptor("prop", services));
            
            ComponentExporter exporter = new ComponentExporter(typeof(Thing), logicalType);
            ExportContext context = new ExportContext();
            context.Register(exporter);
            
            JsonRecorder writer = new JsonRecorder();
            Thing thing = new Thing();
            context.Export(thing, writer);
            
            Assert.AreSame(context, memberExporter.ExportContext);
            Assert.AreSame(writer, memberExporter.ExportWriter);
            Assert.AreSame(thing, memberExporter.ExportSource);
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:22,代码来源:TestComponentExporter.cs


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