Hydrating

My first Nuget project: Hydrating.  Also a Codeplex project : http://hydrating.codeplex.com/ 

It can re-make an object by adding items of “property/value”

It comes in 2 flavors: .NET 2.0 ( reflection ) and .NET 4  ( expression).

Sample Usage:

Sample usage:
var Model = new HydrateGeneric<MyModel>();
Model.AddNewProperty("OneProp", "bb");
Model.AddNewProperty("newData.StartDate", DateTime.Now.AddDays(1).ToString());
Model.AddNewProperty("newData.SecondProp", "AB");
Model.AddNewProperty("newData.aOne.ThirdProp", "XXX");
var data = Model.NewObject();
Console.WriteLine(data.newData.SecondProp);
Console.WriteLine(data.newData.StartDate);
Console.WriteLine(data.newData.aOne.ThirdProp);

 

It comes from a Paulo Morgado idea from http://msmvps.com/blogs/paulomorgado/archive/tags/ExpressionTrees/default.aspx . However, his initialization does not specify property name – so it’s rather error prone if you do not specify properties + values in right order. I have somewhat improved by

 

Model. AddNewProperty("OneProp", "bb");

 

Enjoy!

http://hydrating.codeplex.com/

https://nuget.org/packages/Hydrate