Skip to content

Fluent API for working with data types #21

@jzabroski

Description

@jzabroski

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
    }
}

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