문제

데이터 저장소의 테이블과 상당히 다른 개념적 클래스로 O/R 매핑을 수행하는 Entity Framework 프로젝트를 실제로 출시한 사람이 있습니까?

내 말은 접합(M:M) 테이블을 다른 엔터티로 축소하여 형성한다는 뜻입니다. 개념적 비즈니스 도메인에 존재하지만 다음과 같이 구성되는 클래스 여러 테이블 데이터스토어에서.MSDN에서 볼 수 있는 모든 예제에서는 상속을 거의 사용하지 않고 접합 테이블을 다른 엔터티로 축소하거나 조회 테이블을 엔터티로 축소합니다.

나는 일반적으로 비즈니스 객체에 대해 수행할 것으로 예상되는 모든 CRUD 작업을 지원하는 아래의 예를 듣거나 보고 싶습니다.

  1. 차량 테이블과 색상 테이블.색상은 여러 차량(1:M)에 나타날 수 있습니다.이는 Color 속성을 갖는 개념적 클래스 UsedCar를 형성합니다.

  2. Doctor, DoctorPatients 및 Patients 테이블(다대다 구성)의사에게는 환자가 많고, 환자에게는 의사가 많을 수 있습니다(M:M).Doctor(Patients 컬렉션이 있음)와 Patients(Doctors 컬렉션이 있음)의 두 가지 개념 클래스를 매핑합니다.

Entity Framework에서 CSDL 및 SSDL을 사용하여 이를 보거나 수행한 사람이 있습니까?실제로 어떤 항목에도 매핑되지 않으면 CSDL은 좋지 않습니다.

도움이 되었습니까?

해결책

나는 그것이 무엇인지 알아보기 위해 기존 프로젝트(~60개 테이블, 상속 포함 3개)에서 Entity Framework를 사용하려고 시도했습니다.내 경험은 다음과 같이 요약됩니다.

디자이너 표면이 복잡합니다.매핑은 직관적이지 않으며 누군가는 동시에 여러 개의 도구 창을 열어 두는 것이 허용된다고 생각했을 것입니다.수동으로 객체를 생성하고 올바른 필드를 매핑하는 데 오랜 시간이 걸렸습니다. 코드에서 객체와 대화하는 것은 여전히 ​​이상했습니다.데이터베이스 통신을 처리하는 것이 필수적이지만, 나는 제어권을 EF에 넘겨주는 것이 수동으로 하는 것보다 훨씬 더 힘든 일이라고 생각합니다..

Visual Studio를 다시 시작할 때까지 디자이너가 로드되지 않는 경우도 있습니다.나는 그것이 단지 버그라고 확신하지만 VS를 다시 시작하는 것은 성가신 일입니다.

모든 작업은 단일 파일로 끝나므로 여러 개발자 버전을 병합하고 싶지 않습니다.

프로파일러를 통해 관찰한 결과 SQL은 그다지 좋지 않았습니다.나는 그 이유를 자세히 조사하지는 않았지만 첫 번째 시도에서 더 나쁜 것을 작성해야 한다는 압력을 받을 것입니다.

다른 팁

Entity Framework - 불신임 투표

내가 할말은 그게 다야...

이런 뜻인가요?

<edmx:ConceptualModels>
  <Schema xmlns="http://schemas.microsoft.com/ado/2006/04/edm" Namespace="Model1" Alias="Self">
    <EntityContainer Name="Model1Container" >
      <EntitySet Name="ColorSet" EntityType="Model1.Color" />
      <EntitySet Name="DoctorSet" EntityType="Model1.Doctor" />
      <EntitySet Name="PatientSet" EntityType="Model1.Patient" />
      <EntitySet Name="UsedCarSet" EntityType="Model1.UsedCar" />
      <AssociationSet Name="Vehicle_Color" Association="Model1.Vehicle_Color">
        <End Role="Colors" EntitySet="ColorSet" />
        <End Role="Vehicles" EntitySet="UsedCarSet" /></AssociationSet>
      <AssociationSet Name="DoctorPatient" Association="Model1.DoctorPatient">
        <End Role="Doctor" EntitySet="DoctorSet" />
        <End Role="Patient" EntitySet="PatientSet" /></AssociationSet>
      </EntityContainer>
    <EntityType Name="Color">
      <Key>
        <PropertyRef Name="ColorID" /></Key>
      <Property Name="ColorID" Type="Int32" Nullable="false" />
      <NavigationProperty Name="Vehicles" Relationship="Model1.Vehicle_Color" FromRole="Colors" ToRole="Vehicles" /></EntityType>
    <EntityType Name="Doctor">
      <Key>
        <PropertyRef Name="DoctorID" /></Key>
      <Property Name="DoctorID" Type="Int32" Nullable="false" />
      <NavigationProperty Name="Patients" Relationship="Model1.DoctorPatient" FromRole="Doctor" ToRole="Patient" /></EntityType>
    <EntityType Name="Patient">
      <Key>
        <PropertyRef Name="PatientID" /></Key>
      <Property Name="PatientID" Type="Int32" Nullable="false" />
      <NavigationProperty Name="Doctors" Relationship="Model1.DoctorPatient" FromRole="Patient" ToRole="Doctor" />
      </EntityType>
    <EntityType Name="UsedCar">
      <Key>
        <PropertyRef Name="VehicleID" /></Key>
      <Property Name="VehicleID" Type="Int32" Nullable="false" />
      <NavigationProperty Name="Color" Relationship="Model1.Vehicle_Color" FromRole="Vehicles" ToRole="Colors" /></EntityType>
    <Association Name="Vehicle_Color">
      <End Type="Model1.Color" Role="Colors" Multiplicity="1" />
      <End Type="Model1.UsedCar" Role="Vehicles" Multiplicity="*" /></Association>
    <Association Name="DoctorPatient">
      <End Type="Model1.Doctor" Role="Doctor" Multiplicity="*" />
      <End Type="Model1.Patient" Role="Patient" Multiplicity="*" /></Association>
    </Schema>
</edmx:ConceptualModels>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top