1

SQLServerの構文は次のとおりです。

select tableAColumn1, tableAColumn2, tableBColumn1
from tableA, tableB
where ISNUMERIC(tableAColumn1) = 1
and CONVERT(INT, tableAColumn1) = tableBColumn1
and tableAColumn2 = 'something'

Fluent NHibernateでこれを達成するための最良の方法は何でしょうか?結果のClassMapを取得するには、いくつのクラスが必要で、どのように表示されますか?

編集:

public class BarausInfoMap : ClassMap<BarausInfo>
    {
        public BarausInfoMap()
        {
            Table("BARAUS");

            Id(x => x.nr);

            Map(x => x.betrag);

            Join("BARAUSLANG", m =>
            {
                m.Fetch.Join();

                m.KeyColumn("Ula");
                m.Map(x => x.bezeichnung);
                m.Map(x => x.sprache);
                m.Map(x => x.la);
                this.Where("m.la = 'SPE'");
            });
        }
    }

nr列はintで、ula列は文字列ですが、これらを結合する必要があります。2.また、this.whereは外部テーブルを参照しますが、内部テーブルを参照する必要があります。

4

1 に答える 1

1

次のようなクエリを作成するよりも、個別のエンティティと個別のマッピングを使用する方が良いかもしれません

queryOver<BarausInfo>.JoinQueryOver(x => x.BarauslangObject, barauslangAlias, JoinType.InnerJoin, conjunction)

接続詞にはISNUMERIC(tableAColumn1) = 1and tableAColumn2 = 'something' が含まれます。BarausInfo マッピングでは、References(v => v.BarauslangObject).Formula("CONVERT(INT, tableAColumn1) = tableBColumn1") のようなものを指定できます。数式で列を正しく指定する方法を見つけてください。

于 2012-12-19T15:55:13.193 に答える