これが重複としてマークされる前に、私は他の関連する投稿をチェックして、私の質問に答えません。複数のテーブルをエンティティフレームワーク内の単一のエンティティクラスにマッピングする
私は、1対1の関係を持つ2つのテーブルを持つレガシーデータベースを作成しています。 現在、これらのテーブルごとに1つのタイプ(1Test:1Result)が定義されています これらの特定のテーブルを1つのクラスにマージしたいと思います。
現在の種類は、私は私は現在、当社のレガシーのOracleデータベースにこれらをマッピングするための流暢APIを使用しています。この
public class TestResult
{
public int Id { get; set; }
public string Status { get; set; }
public string Analysis { get; set; }
public string ComponentList { get; set; }
public string TestName { get; set; }
public string Text { get; set; }
public string Units { get; set; }
public bool OutOfRange { get; set; }
public string Status { get; set; }
public string Minimum { get; set; }
public string Maximum { get; set; }
public virtual Instrument InstrumentUsed { get; set; }
}
のように見えるためにそれらを好むこの
public class Result
{
public string Id { get; set; }
public string Name { get; set; }
public string Text { get; set; }
public string Units { get; set; }
public bool OutOfRange { get; set; }
public string Status { get; set; }
public string Minimum { get; set; }
public string Maximum { get; set; }
public virtual Instrument InstrumentUsed { get; set; }
public virtual Test ForTest { get; set; }
}
public class Test
{
public int Id { get; set; }
public string Status { get; set; }
public string Analysis { get; set; }
public string ComponentList { get; set; }
public virtual Sample ForSample { get; set; }
public virtual Result TestResult { get; set; }
}
のように見えます。
これらを1つのクラスに結合する最良の方法は何でしょうか? これは従来のデータベースです。テーブルの変更はオプションではなく、ビューを作成することはプロジェクトの現時点で実行可能な解決策ではありません。
です? –
どのように楽器にマッピングしますか? – roland