public void ComponentMappingDemo()
{
//show how " /> 亚洲精品久久久久69影院,20岁αsrian男同志免费,有码 亚洲 制服 国产 在线

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

NHibernate3剖析:Mapping篇之ConfORM實戰(5):Component語義

  Component語義

  使用ConfORM“映射”組件,我們無需特別設置,ConfORM內部會根據Domain定義來判定組件,一般而言,沒有主鍵的類就是組件。

[Test]
public void ComponentMappingDemo()
{
//show how work with components and how ConfORM understands OOP
var orm = new ObjectRelationalMapper();
var mapper = new Mapper(orm);
//use the definition of table-to-class strategy class by class
orm.TablePerClass<Person>();
// Show the mapping to the console
var mapping = mapper.CompileMappingFor(new[] { typeof(Person) });
Console.Write(mapping.AsString());
}

  一些Domain范例

  我們使用各種集合定義Domain:

  1.Mapping a class with components

  Person實體有兩個組件:

public class Person
{
public int Id { get; set; }
public Name Name { get; set; }
public Address Address { get; set; }
}

public class Name
{
public string First { get; set; }
public string Last { get; set; }
}
public class Address
{
public string Street { get; set; }
public int CivicNumber { get; set; }
}

  Mapping

  輸出HbmMapping的映射字符串結果:

ClassWithComponents  2.Mapping a class with double usage of same component

  在上面Domain的基礎上新增一個Name類型的屬性:

public class Person
{
public int Id { get; set; }
public Name Name { get; set; }
public Name ShowBusinessAlias { get; set; }
public Address Address { get; set; }
}

  Mapping

  輸出HbmMapping的映射字符串結果:

ClassWithDoubleSameComponents  3.Collection of components

  使用一個集合,而不是單一組件:

public class Person
{
private Iesi.Collections.Generic.ISet<Address> addresses;
public Person()
{
addresses = new Iesi.Collections.Generic.HashedSet<Address>();
}
public int Id { get; set; }
public Name Name { get; set; }
public ICollection<Address> Addresses { get { return addresses; } }
}

  Mapping

  輸出HbmMapping的映射字符串結果:

CollectionOfComponents  4.Bidirectional relation

  實現實體與組件的雙向關聯關系:

public class Person
{
public int Id { get; set; }
public Name Name { get; set; }
public Name ShowBusinessAlias { get; set; }
public Address Address { get; set; }
}
public class Name
{
public Person Person { get; set; }
public string First { get; set; }
public string Last { get; set; }
}

  Mapping

  輸出HbmMapping的映射字符串結果:

BidirectionalRelation  結語

  這篇文章展示ConfORM的Components語義應用,映射了一些Domain示例。接下來繼續介紹ConfORM。Are you ConfORM?

  參考資料

  Fabio Maulo:ConfORM:“Mapping” Components

NET技術NHibernate3剖析:Mapping篇之ConfORM實戰(5):Component語義,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 97色伦在色在线播放 | 亚洲 欧美 中文 日韩 另类 | 丰满五十六十老熟女HD60 | 国产精品无码中文在线AV | 任你懆视频 这里只有精品 人与人特黄一级 | 日本精品久久久久中文字幕 1 | 欧美 日韩 亚洲 在线 | 老少配xxxxx欧美 | 男女牲交全过程免费播放 | 女人麻豆国产香蕉久久精品 | 九色终合九色综合88 | 99热婷婷国产精品综合 | 精品亚洲一区二区三区在线播放 | 美女张开腿让我了一夜 | 欧美多人群p刺激交换电影 欧美多毛的大隂道 | 男男校园园bl文全肉高h寝室 | 国产女人视频免费观看 | 精品亚洲一区二区三区在线播放 | 久久视频这里只精品99re8久 | 婷婷开心激情综合五月天 | 两个奶被男人揉了一个晚上 | 国产GV天堂亚洲国产GV刚刚碰 | 欧美亚洲另类丝袜自拍动漫 | 妞干网手机免费视频 | 国产99久久九九精品无码不卡 | adc影院在线 | 国产精品内射久久久久欢欢 | 在线国内自拍精品视频 | 国产三级精品三级男人的天堂 | 嫩草国产福利视频一区二区 | 色综合a在线 | 亚洲一区二区三不卡高清 | 亚洲国产精品一区二区第一页 | 黄色888 | 寻找最美乡村教师颁奖晚会 | 亚洲国产精品免费线观看视频 | 伊人亚洲AV久久无码精品 | 伊人伊人伊人 | 热巴两次用约老师屁股发底线球 | 久久国产成人午夜AV影院无码 | 日本在线高清不卡免费播放 |