まず、POCO オブジェクトを定義するドメイン レイヤーを作成し、EF Code First を使用してこれらのドメイン オブジェクトをデータベースに永続化するデータ アクセス レイヤーを作成しました。このプロジェクトの UI が必要になり、MVC 4 プロジェクトを作成しました。厳密に型指定されたビューを作成する必要があるため、ビューに渡すモデルが必要です。
私の質問は、データ注釈を追加できるように、Model フォルダーのどこにドメイン オブジェクトを再作成する必要があるかということです。たとえば、私は顧客を持っています
public class Customer
{
public int CustomerId { get; set; }
public int RetailerId { get; set; }
public string CustomerName { get; set; }
public string CustomerEmail { get; set; }
public int PointsBalance { get; set; }
public decimal CashBalance { get; set; }
public ICollection<LoyaltyCard> LoyaltyCards { get; set; }
public virtual Retailer BusinessName { get; set; }
}
そして、次のような小売業者オブジェクト:
public class Retailer
{
public int RetailerId { get; set; }
public string BusinessName { get; set; }
public string EmailsAddress { get; set; }
public int PhoneNumber { get; set; }
public ICollection<Location> BusinessLocations { get; set; }
public ICollection<Reward> Rewards { get; set; }
public Industry Industry { get; set; }
}
ドメインレイヤーの現在のドメインオブジェクトに注釈を追加する必要がありますか?そうすれば、ドメインオブジェクトをPOCOオブジェクトにするという目的に違反しません。または、Model フォルダーにドメイン オブジェクトを再作成する必要がありますか? -それは重複していないでしょうか。何かポインタがあれば教えてください。