I saw a very interesting blog post
public class TableStorageInitializer<TTableEntity> where TTableEntity : class, new()
{
public void Initialize()
{
InitializeInstance(new TTableEntity());
}
public void InitializeInstance(dynamic entity)
{
entity.PartitionKey = Guid.NewGuid().ToString();
entity.RowKey = Guid.NewGuid().ToString();
}
}
Note that InitializeInstance takes one parameter, which is of type dynamic. Now, to test this class, I defined another class that is nested in my main program class as follows:
class Program
{
static void Main(string[] args)
{
TableStorageInitializer<MyClass> x = new TableStorageInitializer<MyClass>();
x.Initialize();
}
private class MyClass
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public DateTime Timestamp { get; set; }
}
}
: "MyClass" .
, , Microsoft.CSharp.RuntimeBinder.RuntimeBinderException "entity.PartitionKey = Guide.NewGuid(). ToString()",
, , , : " PartitionKey".
alt text http://img697.imageshack.us/img697/4188/testdl.png
, , . , , , ? , - , - ?