Object Hydrator Fluent Interface Now Type Safe
Thanks to a patch submission by Hakan Forss the Object Hydrator Fluent Interface is now type safe, with all the magic strings removed. The standard inferences are still there so you could do most of your generation without ever using the advanced methods.
The new syntax for the example in my last post looks like this:
string defaultValue = "Testing123";
Hydrator<SimpleCustomer> hydrator = new Hydrator<SimpleCustomer>()
.With(x => x.Description, defaultValue);
SimpleCustomer customer = hydrator.GetSingle();
For the second example where you wanted to override the Company name generation, you actually have two choices:
Hydrator<SimpleCustomer> hydrator = new Hydrator<SimpleCustomer>()
.WithLastName(x => x.Company);
SimpleCustomer customer = hydrator.GetSingle();
Hydrator<SimpleCustomer> hydrator2 = new Hydrator<SimpleCustomer>()
.With(x => x.Company, new FirstNameGenerator());
SimpleCustomer customer2 = hydrator.GetSingle();
Just kind of depends on what your style is...both work the same.
More to come as we creep on on a release. Feel free to check this version (.5) out at http://objecthydrator.codeplex.com
*fixed url
Ryan