개체 모델을 응용 프로그램으로 설계하고 있으며 개체와 테이블간에 임피던스 불일치가 확실합니다. 예를 들어 내가 가진 : ORM을 사용한 도메인 기반 디자인
Product
-----------
ProductId,
ProductTypeCode,
StatusCode,
SKUNumber
ProductMarketAvailability
--------------------------
ProductMarketAvailabilityId,
ProductId,
MarketId,
Rank
ProductDescription
------------------
ProductDescriptionId,
ProductId,
MarketId,
StatusId,
DescriptionTypeId,
Description
이 (내가 룩업 테이블을 설명 didnt가 : 상태, DescriptionType, ProductType, 시장)
나는 도메인 클래스 갖고 싶어 :
Product
--------------
ProductId,
SkuNumber,
MarketId,
MarketName,
StatusCode,
Status,
Title ,
Description,
Caption,
Rank
을
LLblGen 프로 또는 Entity Framework 포함 :
- how i can map these tables my domain class?
- Is it a best way to deal with this through Domain classes or better to
isolate domain classes from ORM generated classes
- If I manually map ORM classes data to my domain classes then when i
persisting my Domain classes (imagine they are POCO Self tracking),
how can i write managable , well crafted code ?
i dont want to write , it doesnt look so right to me:
if (myProduct.TitleisDirty)
{
ProductDescription p= myRepository.GetDescriptionById
(myProduct.ProductDescriptionIdForTitle);
p.Description=myProduct.Title;
p.SubmitChanges();
}
if (myProduct.RankisDirty)
{
ProductMarketAvailability pma= myRepository.GetMarketById
(myProduct.ProductMarketAvailabilityId);
pma.Rank=myProduct.Rank;
pma.SubmitChanges();
}
읽어 주셔서 감사합니다.