internal static void ExportTable(ExportContext context, DataTable table, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(table != null);
            Debug.Assert(writer != null);

            var view = table.DefaultView;

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

            var exporter = context.FindExporter(view.GetType());

            if (exporter != null)
            {
                exporter.Export(context, view, writer);
            }
            else
            {
                DataViewExporter.ExportView(context, view, writer);
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        internal static void ExportTable(ExportContext context, DataTable table, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(table != null);
            Debug.Assert(writer != null);

            DataView view = table.DefaultView;

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

            IExporter exporter = context.FindExporter(view.GetType());
            
            if (exporter != null)
                exporter.Export(context, view, writer);
            else
                DataViewExporter.ExportView(context, view, writer);
       }