私はC#でFluent NHibernateをテストし始めました 20の関連クラスを持つよく正規化されたオブジェクト構造を持っています。 私は現在、NHibernate 3.2でFluent 1.3を使用しています。 これまでのところ私はうまく適合するオートマップ機能を使用することができました。 非常に便利です!Fluent AutoMapでID列を一時的に無効にしますか?
BUT ... 3つのテーブルは、特定のId値でレコードを設定する必要がある「列挙テーブル」です。 私はこれらのテーブルの手動マッピングを作成し、残りのテーブルを自動化しようとしました。 マニュアルテーブルを作成すると、自動マップされたテーブルを参照するために失敗します(手動マッパーでは使用できません)
オートマッピングは使用できますか? 私はカスタムコンベンションをしようとしましたが、成功しませんでした。
public class OverrideIdentityGeneration : Attribute
{
}
public class ConventionIdentity : AttributePropertyConvention<OverrideIdentityGeneration>
{
protected override void Apply(OverrideIdentityGeneration attribute, IPropertyInstance instance)
{
instance.Generated.Never();
}
}
他にもいくつかの方法がありますか? 更新
おかげで、それがうまく働きました! 私が逃したのはIIdConventionでした.... 利用可能なすべての慣習を持つリストはどこにありますか? 私の次の課題は、ForeignKeyConstraintNameConventionを作成することですが、私はもう一度推測することに悩まされています。 –
「FluentNHibernate.Conventions.I'」と入力してintellisenseに伝えるか、http://wiki.fluentnhibernate.org/Conventions – Firo
ご協力ありがとうございます! –