如何加入表?

时间:2013-03-15 07:36:01

标签: nhibernate fluent-nhibernate queryover

我只有阅读权利。如何在没有关系的情况下加入表格?

详情实体:

public class Detail
{
    public virtual long Rscode{get; set;}
    public virtual long ID{get; set;}
    public virtual int Year{get; set;}
    public virtual int Month{get; set;}
    public virtual long Qr{get; set;}
    public virtual string Sign{get; set;}

}

PutedDetail实体:

public class PutedDetail
{
    public virtual int Y{get; set;}
    public virtual int M{get; set;}
    public virtual string Sign{get; set;}
    public virtual long ID{get; set;}
    public virtual string Shortname{get; set;}
    public virtual decimal Quantity{get; set;}

}

详细信息映射:

public class DetailMapping:ClassMap<Detail>
    {
    public DetailMapping()
        {
            Table("PLANS_DATA");

            Id(m => m.Id).GeneratedBy.Native();
            Map(m => m.Rscode);
            Map(m => m.Year);
            Map(m => m.Month);
            Map(m => m.Qr);
            Map(m => m.Sign);

        }
   }

Puted Detail mapping:

public class PutedDetailMapping:ClassMap<PutedDetail>
    {
    public PutedDetailMapping()
        {
            Table("PUTED");
            Id(m => m.Id);
            Map(m => m.M);
            Map(m => m.Y);
            Map(m => m.Sign);
            Map(m => m.Shortname);            
            Map(m => m.Quantity);
        }
    }

SQL查询:

select p1.sign, 
       p1.qr,
       p2.quantity 
from plans_data p1 join puted p2 on(p1.sign=p2.sign and 
                                           p1.month=p2.year and
                                           p1.year=p2.year)
where sign = '3d934gf'

如何通过q​​ueryover构建此查询?

P.S。我的英语是sory。

0 个答案:

没有答案