0

I'm using an ORM sytem (sqlite-net) for my android application. I want to be able to create my DB mapping classes dynamically, and be able to add attributes to members, is this possible? I would need to create something like this dynamically:

class ConfigData
{
    [PrimaryKey, AutoIncrement]
    public int id { get; set; }
    [MaxLength(20)]
    public string ip { get; set; }
    [MaxLength(128)]
    public string port { get; set; }
}

Thanks in advance.

4

2 回答 2

1

也许反射命名空间是你可能使用的,这里有一个例子: http: //mironabramson.com/blog/post/2008/06/Create-you-own-new-Type-and-use-it-on-run-时间-(C).aspx

于 2012-06-11T09:17:09.223 回答
0

在 C# 4.0 中可以使用动态类型。

于 2012-06-11T09:07:11.353 回答