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


C# ExportContext类代码示例

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


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

示例1: ExportValue

 protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
 {
     Debug.Assert(value != null);
     Debug.Assert(writer != null);
     
     ExportTime((DateTime) value, writer);
 }
开发者ID:liuxing7954,项目名称:cangku_1,代码行数:7,代码来源:DateTimeExporter.cs

示例2: ExportData

        protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context)
        {
            object data = GetData();

            var stringData = data as string;
            if (stringData != null)
            {
                writer.WriteString(stringData);
                return;
            }

            var listData = data as List<string>;
            if (listData != null)
            {
                string output = String.Join(";", listData.ToArray());
                writer.WriteString(output);
                return;
            }

            var enumerableData = data as IEnumerable;
            if (enumerableData != null)
            {
                var sb = new StringBuilder();
                foreach (var item in enumerableData)
                {
                    if (sb.Length != 0)
                        sb.Append(";");
                    sb.Append(Convert.ToString(item, CultureInfo.InvariantCulture));
                }
                writer.WriteString(sb.ToString());
                return;
            }

            throw ExportNotImplementedException(data);
        }
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:35,代码来源:ChoiceField.cs

示例3: ExportValue

        protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(value != null);
            Debug.Assert(writer != null);
            
            if (_properties.Count == 0)
            {
                writer.WriteString(value.ToString());
            }
            else
            {
                writer.WriteStartObject();

                foreach (PropertyDescriptor property in _properties)
                {
                    object propertyValue = property.GetValue(value);
                
                    if (!JsonNull.LogicallyEquals(propertyValue))
                    {
                        writer.WriteMember(property.Name);
                        context.Export(propertyValue, writer);
                    }
                }

                writer.WriteEndObject();
            }
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:28,代码来源:ComponentExporter.cs

示例4: CreateFromDataContractSerializer

 public static string CreateFromDataContractSerializer(Type type, MemberInfo[] pathToMember, StringBuilder rootElementXpath, out XmlNamespaceManager namespaces)
 {
     ExportContext context;
     if (type == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
     }
     if (pathToMember == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("pathToMember"));
     }
     DataContract dataContract = DataContract.GetDataContract(type);
     if (rootElementXpath == null)
     {
         context = new ExportContext(dataContract);
     }
     else
     {
         context = new ExportContext(rootElementXpath);
     }
     for (int i = 0; i < pathToMember.Length; i++)
     {
         dataContract = ProcessDataContract(dataContract, context, pathToMember[i]);
     }
     namespaces = context.Namespaces;
     return context.XPath;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:XPathQueryGenerator.cs

示例5: ExportDataSet

        private static void ExportDataSet(ExportContext context, DataSet dataSet, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(dataSet != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
    
            foreach (DataTable table in dataSet.Tables)
            {
                writer.WriteMember(table.TableName);

                //
                // If there is an exporter (perhaps an override) for the 
                // DataTable in effect then use it. Otherwise our 
                // DataTableExporter.
                //

                IExporter tableExporter = context.FindExporter(table.GetType());
                
                if (tableExporter != null)
                    tableExporter.Export(context, table, writer);
                else
                    DataTableExporter.ExportTable(context, table, writer);
            }
    
            writer.WriteEndObject();
        }
开发者ID:RyanWangTHU,项目名称:ccv2,代码行数:28,代码来源:DataSetExporter.cs

示例6: ResolveFluentMethod

        private static void ResolveFluentMethod(ExportContext context)
        {
            if (string.IsNullOrEmpty(_parameters.ConfigurationMethod)) return;
            var methodPath = _parameters.ConfigurationMethod;
            var path = new Stack<string>(methodPath.Split('.'));
            var method = path.Pop();
            var fullQualifiedType = string.Join(".", path.Reverse());

            foreach (var sourceAssembly in context.SourceAssemblies)
            {
                var type = sourceAssembly.GetType(fullQualifiedType, false);
                if (type != null)
                {
                    var constrMethod = type.GetMethod(method);
                    if (constrMethod != null && constrMethod.IsStatic)
                    {

                        var pars = constrMethod.GetParameters();
                        if (pars.Length == 1 && pars[0].ParameterType == typeof(ConfigurationBuilder))
                        {
                            context.ConfigurationMethod = builder => constrMethod.Invoke(null, new object[] { builder });
                            break;
                        }
                    }
                }
            }
        }
开发者ID:reinforced,项目名称:Reinforced.Typings,代码行数:27,代码来源:Bootstrapper.cs

示例7: Process

        public void Process()
        {
            using(SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create(@"D:\product.xlsx", SpreadsheetDocumentType.Workbook))
            {
                var excelExportContext = new ExportContext(spreadsheetDocument);

                uint rowNo = 0;
                foreach(var product in _products)
                {
                    rowNo++;
                    if(product.Price > 44)
                    {
                        product.MapColumn<Product>(x => x.Description, "F");
                        product.MapStyle<Product>(x => x.Name, new CellFill(hexColor: "FFFF0000"));
                    }

                    if(product.Price < 33)
                    {
                        product.MapStyle<Product>(x => x.Code, new CellBorder(left: true, right: true));
                    }

                    excelExportContext.RenderEntity(product, rowNo);
                }

                excelExportContext.SaveChanges();
            }
        
        }
开发者ID:TopSoftSolutions,项目名称:TopSoft.ExcelExport,代码行数:28,代码来源:ProductExport.cs

示例8: ExportData

		protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context)
		{
            var data = GetData();
            var node = data as Node;
			if (node != null)
			{
				writer.WriteStartElement("Path");
				writer.WriteString(node.Path);
                if (context != null)
                    context.AddReference(node.Path);
				writer.WriteEndElement();
				return;
			}

            var nodes = data as IEnumerable;
            if (nodes != null)
			{
                foreach (Node item in nodes)
				{
					writer.WriteStartElement("Path");
					writer.WriteString(item.Path);
                    if (context != null)
                        context.AddReference(item.Path);
					writer.WriteEndElement();
				}
				return;
			}

			throw ExportNotImplementedException(GetData());
		}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:30,代码来源:ReferenceField.cs

示例9: CreateFromDataContractSerializer

        // Here you can provide your own root element Xpath which will replace the Xpath of the top level element
        public static string CreateFromDataContractSerializer(Type type, MemberInfo[] pathToMember, StringBuilder rootElementXpath, out XmlNamespaceManager namespaces)
        {
            if (type == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("type"));
            }
            if (pathToMember == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("pathToMember"));
            }

            DataContract currentContract = DataContract.GetDataContract(type);
            ExportContext context;

            if (rootElementXpath == null)
            {
                context = new ExportContext(currentContract);
            }
            else
            {
                // use the provided xpath for top level element
                context = new ExportContext(rootElementXpath);
            }

            for (int pathToMemberIndex = 0; pathToMemberIndex < pathToMember.Length; pathToMemberIndex++)
            {
                currentContract = ProcessDataContract(currentContract, context, pathToMember[pathToMemberIndex]);
            }

            namespaces = context.Namespaces;
            return context.XPath;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:33,代码来源:XPathQueryGenerator.cs

示例10: Export

        public string Export(IEnumerable<string> contentTypes, IEnumerable<ContentItem> contentItems, ExportOptions exportOptions) {
            var exportDocument = CreateExportRoot();

            var context = new ExportContext {
                Document = exportDocument,
                ContentTypes = contentTypes,
                ExportOptions = exportOptions
            };

            _exportEventHandlers.Invoke(x => x.Exporting(context), Logger);

            if (exportOptions.ExportMetadata && (!exportOptions.ExportData || contentItems.Any())) {
                exportDocument.Element("Orchard").Add(ExportMetadata(contentTypes));
            }

            if (exportOptions.ExportSiteSettings) {
                exportDocument.Element("Orchard").Add(ExportSiteSettings());
            }

            if (exportOptions.ExportData && contentItems.Any()) {
                exportDocument.Element("Orchard").Add(ExportData(contentTypes, contentItems, exportOptions.ImportBatchSize));
            }

            _exportEventHandlers.Invoke(x => x.Exported(context), Logger);

            return WriteExportFile(exportDocument.ToString());
        }
开发者ID:mikmakcar,项目名称:orchard_fork_learning,代码行数:27,代码来源:ImportExportService.cs

示例11: GenericExportingReflectiveTypeData

 // TODO: sort out argument order, etc, with superclass
 public GenericExportingReflectiveTypeData(
 ExportContext ctx, Type fullType, TypeData baseType, TypeData[] args)
     : base(fullType, ctx)
 {
     _baseType = baseType;
     _args = args;
 }
开发者ID:raygreenwell,项目名称:export,代码行数:8,代码来源:GenericExportingReflectiveTypeData.cs

示例12: ExportValue

 protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
 {
     Debug.Assert(context != null);
     Debug.Assert(value != null);
     Debug.Assert(writer != null);
     
     ExportRecord(context, (DbDataRecord) value, writer);
 }
开发者ID:RyanWangTHU,项目名称:ccv2,代码行数:8,代码来源:DbDataRecordExporter.cs

示例13: ExportData

		protected override void ExportData(System.Xml.XmlWriter writer, ExportContext context)
		{
			//-- For exmple:
			//   <Url authType="Forms">localhost:1315/</Url>
			//   <Url authType="Windows">name.server.xy</Url>

            writer.WriteRaw(GetRawXml());
		}
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:8,代码来源:UrlListField.cs

示例14: ExportValue

        protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
        {
            if (context == null) throw new ArgumentNullException("context");
            if (value == null) throw new ArgumentNullException("value");
            if (writer == null) throw new ArgumentNullException("writer");

            ExportTime((DateTime) value, writer);
        }
开发者ID:db48x,项目名称:KeeFox,代码行数:8,代码来源:DateTimeExporter.cs

示例15: ExportValue

        protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(value != null);
            Debug.Assert(writer != null);

            ((IJsonExportable) value).Export(context, writer);
        }
开发者ID:liuxing7954,项目名称:cangku_1,代码行数:8,代码来源:ExportAwareExporter.cs


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