-1
은 그래서 간단한이다-A이 예와 같은 관계를 가정 해 봅시다 : 내가 데이터베이스에서 엔티티를 매핑있을 때올바른 방법은 IS-A C#의 관계가
create table EntityAbstract(
IDEntityAbstract int identity primary key,
Name nvarchar(50) not null,
)
create table OneOfConcreteEntity(
EntityAbstract int,
constraint PK_Image primary key (EntityAbstract),
constraint FK_Image foreign key (EntityAbstract) references EntityAbstract(IDEntityAbstract)
)
내가 그들 각각의 고유해야 개체 또는 추상 실체에서 확장 구체적인 클래스를 만들어야합니까?
예컨대 :
public class EntityAbstract
{
public int EntityAbstractID { get; set; }
public string Name { get; set; }
public EntityAbstract(int entityID, string name)
{
this.EntityAbstractID = entityID;
this.Name = name;
}
}
public class OneOfConcreatEntity : EntityAbstract
{
public OneOfConcreatEntity(int entityID, string name) : base(entityID, name){ }
}
최선의 선택은 무엇입니까? 하나 이상의 구체적인 개체와 더 복잡한 개체를 고려하십시오.