public void ComponentMappingDemo()
{
//show how " /> 稚嫩挤奶h调教h,精品无码久久久久久久动漫,囯产精品麻豆巨作久久

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

NHibernate3剖析:Mapping篇之ConfORM實(shí)戰(zhàn)(5):Component語義

  Component語義

  使用ConfORM“映射”組件,我們無需特別設(shè)置,ConfORM內(nèi)部會(huì)根據(jù)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實(shí)體有兩個(gè)組件:

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的映射字符串結(jié)果:

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

  在上面Domain的基礎(chǔ)上新增一個(gè)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的映射字符串結(jié)果:

ClassWithDoubleSameComponents  3.Collection of components

  使用一個(gè)集合,而不是單一組件:

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的映射字符串結(jié)果:

CollectionOfComponents  4.Bidirectional relation

  實(shí)現(xiàn)實(shí)體與組件的雙向關(guān)聯(lián)關(guān)系:

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的映射字符串結(jié)果:

BidirectionalRelation  結(jié)語

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

  參考資料

  Fabio Maulo:ConfORM:“Mapping” Components

NET技術(shù)NHibernate3剖析:Mapping篇之ConfORM實(shí)戰(zhàn)(5):Component語義,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 国精产品一区一区三区有限公司 | 日本妞欧洲 | 99精品视频一区在线视频免费观看 | 无人区乱码1区2区3区网站 | caoporn 在线视频 | 欧美男男网站免费观看videos | 凤楼app| 久久精品国产亚洲AV忘忧草蜜臀 | 最近最新的日本字幕MV | 天天射天天干天天插 | 久久草福利自拍视频在线观看 | 97久久伊人精品影院 | 中文中幕无码亚洲在线 | 粗暴玩烂货调教 | 午夜伦伦电影理论片费看 | 曰曰夜夜在线影院视 | 久久综合给会久久狠狠狠 | 日本午夜精品久久久无码 | 亚洲中文字幕在线第六区 | 伊人久久大线蕉香港三级 | 久久人妻熟女中文字幕AV蜜芽 | 天美传媒麻豆精品 | YELLOW免费观看完整视频 | 百性阁论坛首页 | 91亚洲精品 | 亚洲精品AV无码喷奶水糖心 | 嘟嘟嘟WWW在线观看视频高清 | 97在线视频免费人妻 | 亚洲 欧美 日韩 精品 自拍 | 久久久久久天天夜夜天天 | 亚洲精品久久久无码一区二区 | 神马影院在线eecss伦理片 | 最近日本字幕MV免费观看在线 | 亚洲乱码在线卡一卡二卡新区 | 婷婷午夜影院 | 22eee在线播放成人免费视频 | 日韩欧美中文字幕在线二视频 | SM脚奴调教丨踩踏贱奴 | 粉色视频午夜网站入口 | 日本19禁啪啪吃奶大尺度 | 老师的蕾丝小内内湿透了 |