+1  A: 

While I am not exactly sure of your ultimate goal, I may have an option for you. You need a highly dynamic "entity" which will allow your users to create their own data structures. Imperative languages like C# do not lend themselves well to such a thing...and even with a dynamic language, I think you'll likely run into some difficulties. However, XML is an excellent way to represent dynamic data structures in an ad-hoc, runtime-creatable way.

If you are using SQL Server, I recommend you create a simpler type, as depicted below, and store it in a table that uses the 'xml' data type for one of the columns:

public class DynamicEntity
{
    public int ID { get; set; }
    public string TypeName { get; set; }
    public XDocument DynamicContent { get; set; }
}

The above entity could be stored in the following table:

CREATE TABLE DynamicEntity
(
    ID int IDENTITY(1,1) NOT NULL,
    NAME varchar(50) NOT NULL,
    DynamicContent xml NULL
)

Given SQL Server's xml capabilities, you will still be able to query the data in that xml column. Not only that, if you want your users custom structures to be validated against a schema, you could also put that schema in the database and 'type' your xml column against that schema. Using an XML column in SQL Server does come with come caveats, but it might be a simple solution to your otherwise complicated problem.

jrista