Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent API for working with data types #21

Open
jzabroski opened this issue Oct 16, 2018 · 0 comments
Open

Fluent API for working with data types #21

jzabroski opened this issue Oct 16, 2018 · 0 comments

Comments

@jzabroski
Copy link

jzabroski commented Oct 16, 2018

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
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant