Skip to content

allow consuming data without a declared class #9

@jamesmanning

Description

@jamesmanning

This may well be more trouble than it's worth and/or out of scope for the project, but I have a set of spreadsheets I need to pull data from and unfortunately they're not homogeneous in their layout, although they are all in the category of having sheets with a header row and then the rest of the rows in the sheet are for data.

The consumer code that would be nice (but obviously not required, i can always just talk to the underlying gdata directly) would include:

  1. having GetTable<dynamic>(sheetname) (or GetTableAsDynamic if it should be a separate method) that used the header row to determine property names (the IDatabaseClient or IDatabase could expose the public Func<string, string> PropertyNameGetter { get; set; } being used for mapping header names to property names in case the user wants to override the default).
  2. having a GetDataTable that does similar, but instead of being properties in a dynamic POCO, just uses the normal System.Data.DataTable. Optionally, fetch all sheets in spreadsheet as a DataSet.

Similar to how some of the ODBC / Access / ACE / Excel stuff I've used in the past seems to do, it could/should look at the data in each column to figure out the "best" (strongest) type it can use (int, double, string). IIRC the number of rows it would scan to figure out the type for a given column defaulted to 20, but you could configure it as either 0 (all rows) or anything 1 or higher.

Again, this may be way outside the scope of GDataDB, or maybe even better done as a separate project, just wanted to file the issue in case it's something that might end up being a good fit for GDataDB's scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions