For a recent project I had to write a lot of data-oriented tests. This required me to populate the domain model with lot’s of test data. Having to write a lot of new statements and property setters, I was looking for a cleaner alternative when I stumbled over this library: ElasticObject - An expandable dynamic object for .NET 4.0.
A dynamic ElasticObject implementation using .NET 4.0 dynamic features, for fluent access of data types like XML - Access XML <entry name="user"/> via fluent dynamic wrappers, like var n=entry.name; - You can also use it like ExpandoObject, with multi level property support
To start with, here are few scenarios you can use ElasticObject
- An easier, fluid way to work with data formats – like XML and JSON. Presently, we’ve some support for XML.
- Cleaner code though it is duck typed
- A hierarchical way to maintain loosely typed data.
I used it to create a whole object hierarchy in a very simple way, like this:
Read More:
- About ElasticObject - Sample Usecases http://amazedsaint.blogspot.com/2010/02/introducing-elasticobject-for-net-40.html
- A 10 Minute ASP.NET MVC Twitter searchup using Ducktyped Viewmodels using ElasticObject http://amazedsaint.blogspot.com/2010/02/10-minute-twitter-search-app-using-duck.html