Skip to content

Commit

Permalink
added some docs on datasources
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszkubacki committed Feb 14, 2011
1 parent 5287435 commit d65afb2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions doc/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,40 @@ and one more complex:

***Subreport control*** (currently not supported)

Datasource
==============
Datasource can be anything from text file to database data, In general it's any class which implements IDataSource interfece.
Every datasource contains number of fields (table is a good parallel of what datasource is and DataField could be considered as Column).

Currently Monoreports has two build in datasource types:
- C# code based datasource - where ObjectDataSource<> is used
- JSON datasource - where JsonDatasource is used

C# code based datasource
-----------------
ObjectDataSource takes as contructor parameter IEnumerable<T>.
Adding datafield to datasource is taking field name and lambda expression pointing to property of T

example:
[....]
ObjectDataSource<InvoicePosition> objectDataSource = new ObjectDataSource<InvoicePosition>(invoice.Positions);
objectDataSource.AddField ("Index",x=>x.Index);
objectDataSource.AddField ("Description",x=>x.Description);
objectDataSource.AddField ("Quantity",x=>x.Quantity);
objectDataSource.AddField ("PricePerUnitGross",x=>x.PricePerUnitGross);
report.DataSource = objectDataSource;
[....]

TODO - add some description

JSON based datasource
--------------------
TODO - add some description

Parameters
=========

TODO - add some description



Expand Down

0 comments on commit d65afb2

Please sign in to comment.