0

以下のクエリのような結果を得るためにマップを作成しようとしています。where条件のように、Product_Lineへの参照を3列に設定するように製品マッピングを設定するのに苦労しています。流暢を使用してこれを達成するにはどうすればよいですか?

Product テーブル: cId、ProjID、Line など、列 Product_Line テーブル: cId、ProjID、Line など、列

select f.* from Product f join Product_Line v on f.cId = v.CId and f.ProjID = v.ProjID and f.line = v.line

前もって感謝します。RajeshC

まず、調査していただきありがとうございます。ここに詳細情報を記載してください: //Req: ProductLine がない場合は ProductLine を作成し、ProductLine がある場合は更新するように製品を照会したい.

public class ProductMap : ClassMap<Product>
{
    Id(x => x.Id);
    Map(x => x.CustomerId, "CustId");
    Map(x => x.ProjId, "PROJId");
    Map(x => x.LineNumber, "LineNumber");
    Map(x => x.ReportType, "ReportType");
// Reference to Product_Line? - this reference should be based on three columns (custId, ProjId, LineNumber)
    References(x => x.Line); 
}

public class ProductLineMap : ClassMap<ProductLine>
{
    Table("Product_Line");
    Map(x => x.CustomerId, "CustId"); //same column as Product.CustId
    Map(x => x.ProjId, "PROJId"); //Same as Product.ProjId
    Map(x => x.LineNumber, "LINENUMBER"); //Same as Product.LineNumber
    //etc.,
    //for me, this reference is not needed as I need from Product to ProductLine - one way. 
    //References(x => x.Product).Column("ProjId") //
}
4

1 に答える 1

0

C#コードを表示し、SQLを<code>タグでラップすると、はるかに良い答えが得られます...これが私が望むものの推測です

public class ProductMap : ClassMap<Product>
{
    Id(x => x.Id);
    References(x => x.Line); // Reference to Product_Line?
    // etc. 
}

public class ProductLineMap : ClassMap<ProductLine>
{
    Table("Product_Line");
    Id(x => x.Id).Column("cId");
    References(x => x.Product).Column("ProjId")
}
于 2010-09-02T09:53:36.860 に答える