/// <summary>
 /// Returns the PDFDataScema associated with this source.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="context"></param>
 /// <returns>The data schema associated with the source</returns>
 /// <exception cref="System.NotSupportedException" >Thrown if this data source does not support schema extraction</exception>
 public override PDFDataSchema GetDataSchema(string path, PDFDataContext context)
 {
     System.Data.DataSet ds;
     if (this.HasData(out ds))
     {
         PDFDataSchema schema = DataSetSchemaGenerator.CreateSchemaFromSet(ds, context);
         if (!string.IsNullOrEmpty(path))
         {
             if (path == schema.RootPath)
             {
                 return(schema);
             }
             else if (!path.StartsWith(schema.RootPath))
             {
                 return(null);
             }
             else
             {
                 foreach (var one in schema.Items)
                 {
                     if (one.FullPath == path)
                     {
                         PDFDataSchema child = new PDFDataSchema(one.FullPath, one.Children);
                         return(child);
                     }
                 }
                 return(null);
             }
         }
         else
         {
             return(schema);
         }
     }
     else
     {
         return(base.GetDataSchema(path, context));
     }
 }
Ejemplo n.º 2
0
        //
        // support methods
        //

        #region protected virtual PDFDataSchema DoPopulateDataSchema(DataSet dataset, PDFDataContext context)

        protected virtual PDFDataSchema DoPopulateDataSchema(DataSet dataset, PDFDataContext context)
        {
            return(DataSetSchemaGenerator.CreateSchemaFromSet(dataset, context));
        }