0
我有類和需要進行數據表如下 1級如何將類映射到數據庫表?
public class EventType
{
public String Id { get; private set; }
public int Severity { get; set; }
public EventTypeTemplate Template { get; set; }
public IDictionary<String, String> Params { get; set; }
public EventType(string id)
{
Id = id;
Params = new Dictionary<string, string>();
}
}
,二類
public class EventTypeTemplate
{
public String Id { get; private set; }
public int Severity { get; set; }
public String Title { get; set; }
public String Description { get; set; }
public IList<String> Categories { get; private set; }
public IList<String> Queries { get; private set; }
public EventTypeTemplate(string id)
{
Id = id;Categories = new List<string>();
Queries = new List<string>();
}
}
對於類1(事件類型)創建表 作爲表名事件類型
Column type
Id string
Severity int
而且我不知道如何將這些屬性輸入到表列名稱中並鍵入
public EventTypeTemplate Template { get; set; }
public IDictionary<String, String> Params { get; set; }
對於第二類 我創建的表名EventTypeTemplate
Column Type
Id string
Severity int
Title string
Description string
但我不知道該怎麼enterprate遵循財產成表的列名和類型
public IList<String> Categories { get; private set; }
public IList<String> Queries { get; private set; }
任何幫助將不勝感激
maark對不起有錯字問題原來的問題是跟着希望你能回答它 – jay 2011-04-12 02:01:50
它不會改變我的建議,但你的意思是'公共EventTypeTemplate模板'或者它應該是'public categorytocheck Template'? – 2011-04-12 02:22:18
它是公共的EventTypeTemplate模板{get;組; } – jay 2011-04-12 02:32:11