DoddleReport
DoddleReport copied to clipboard
Fluent API for working with data types
I would like code to work more like this:
public class ProductReport : Report<Product>
{
ProductReport()
{
DataField(x => x.UnitPrice) // this automatically infers it is a number,
// and automatically applies DataStyle.HorizontalAlignment = HorizontalAlignment.Right
.WithHeader(x => x.Text.Replace("Unit",string.Empty)) // remove "Unit" from "UnitPrice"
.WithData(x => {
x.AsMoney(); // automatically applies horizontalalignment.right and DataFormatString = "{0:C"}
x.Style.HorizontalAlignment = HorizontalAlignment.Right; // again, less typing
})
.BuildIt(); // converts Expression tree to Report instance variables
}
}