convert inhertied classes of db objects to partial classes of db objects so overwriting of db classes through entityframework does not take effect on our own work.

This commit is contained in:
Ivan Hörler 2018-07-11 08:06:33 +02:00
parent 25c4b52ea7
commit ffafd3cae2
16 changed files with 52 additions and 48 deletions

View File

@ -5,9 +5,9 @@ using System.Web;
using System.ServiceModel; using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class DoctorAccess public partial class Doctor
{ {
public Doctor CreateDoctor(Doctor doctor) public Doctor CreateDoctor(Doctor doctor)
{ {

View File

@ -5,11 +5,11 @@ using System.Web;
using System.ServiceModel; using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class ExamAccess public partial class Exam
{ {
public Exam CreateExam(Exam exam) public Exam CreateExam(EHEC_Server.Exam exam)
{ {
try try
{ {
@ -22,10 +22,10 @@ namespace EHEC_Server.DatabaseAccess
} }
catch (Exception) catch (Exception)
{ {
return new Exam(); return new EHEC_Server.Exam();
} }
} }
public List<Exam> GetAllExams() public List<EHEC_Server.Exam> GetAllExams()
{ {
using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{ {

View File

@ -4,11 +4,11 @@ using System.Linq;
using System.Web; using System.Web;
using System.ServiceModel; using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class OriginAccess public partial class Origin
{ {
public Origin CreateOrigin(Origin origin) public Origin CreateOrigin(EHEC_Server.Origin origin)
{ {
try try
{ {
@ -21,10 +21,10 @@ namespace EHEC_Server.DatabaseAccess
} }
catch (Exception) catch (Exception)
{ {
return new Origin(); return new EHEC_Server.Origin();
} }
} }
public List<Origin> GetAllOrigins() public List<EHEC_Server.Origin> GetAllOrigins()
{ {
using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{ {

View File

@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class Origin_ExamAccess public partial class Origin_Exam
{ {
public Origin_Exam CreateOrigin_Exam(Origin_Exam origin_exam) public Origin_Exam CreateOrigin_Exam(EHEC_Server.Origin_Exam origin_exam)
{ {
try try
{ {
@ -20,10 +20,10 @@ namespace EHEC_Server.DatabaseAccess
} }
catch (Exception) catch (Exception)
{ {
return new Origin_Exam(); return new EHEC_Server.Origin_Exam();
} }
} }
public List<Origin_Exam> GetAllOrigin_Exams() public List<EHEC_Server.Origin_Exam> GetAllOrigin_Exams()
{ {
using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{ {

View File

@ -4,9 +4,9 @@ using System.Linq;
using System.Web; using System.Web;
using System.ServiceModel; using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class PatientAccess public partial class Patient
{ {
public Patient CreatePatient(Patient patient) public Patient CreatePatient(Patient patient)
{ {

View File

@ -4,11 +4,11 @@ using System.Linq;
using System.Web; using System.Web;
using System.ServiceModel; using System.ServiceModel;
namespace EHEC_Server.DatabaseAccess namespace EHEC_Server
{ {
public class ResultAccess public partial class Result
{ {
public Result CreateResult(Result result) public Result CreateResult(EHEC_Server.Result result)
{ {
try try
{ {
@ -21,15 +21,15 @@ namespace EHEC_Server.DatabaseAccess
} }
catch (Exception) catch (Exception)
{ {
return new Result(); return new EHEC_Server.Result();
} }
} }
public List<Result> GetAllResults() public List<EHEC_Server.Result> GetAllResults()
{ {
using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
{ {
ctx.Configuration.ProxyCreationEnabled = false; ctx.Configuration.ProxyCreationEnabled = false;
List<Result> list = new List<Result>(); List<EHEC_Server.Result> list = new List<EHEC_Server.Result>();
return ctx.Results.ToList(); return ctx.Results.ToList();
} }
} }

View File

@ -14,9 +14,8 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess;
public partial class Doctor : DoctorAccess public partial class Doctor
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]

View File

@ -106,13 +106,13 @@
<Content Include="Web.config" /> <Content Include="Web.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DatabaseAccess\DoctorAccess.cs" /> <Compile Include="DatabaseAccess\Doctor.cs" />
<Compile Include="DatabaseAccess\OriginAccess.cs" /> <Compile Include="DatabaseAccess\Origin.cs" />
<Compile Include="DatabaseAccess\Origin_ExamAccess.cs" /> <Compile Include="DatabaseAccess\Origin_Exam.cs" />
<Compile Include="DatabaseAccess\PatientAccess.cs" /> <Compile Include="DatabaseAccess\Patient.cs" />
<Compile Include="DatabaseAccess\ResultAccess.cs" /> <Compile Include="DatabaseAccess\Result.cs" />
<Compile Include="DataBuilder\DataSeeder.cs" /> <Compile Include="DataBuilder\DataSeeder.cs" />
<Compile Include="DatabaseAccess\ExamAccess.cs" /> <Compile Include="DatabaseAccess\Exam.cs" />
<Compile Include="DataBuilder\GenerateDataBuilder.cs" /> <Compile Include="DataBuilder\GenerateDataBuilder.cs" />
<Compile Include="Doctor.cs"> <Compile Include="Doctor.cs">
<DependentUpon>Model.tt</DependentUpon> <DependentUpon>Model.tt</DependentUpon>

View File

@ -14,8 +14,8 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess;
public partial class Exam : ExamAccess public partial class Exam
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]

View File

@ -24,6 +24,9 @@ namespace EHEC_Server
[OperationContract] [OperationContract]
Exam WriteExam(Exam exam); Exam WriteExam(Exam exam);
[OperationContract]
Origin_Exam WriteOrigin_Exam(Origin_Exam origin_exam);
[OperationContract] [OperationContract]
Result WriteResult(Result result); Result WriteResult(Result result);

View File

@ -9,3 +9,4 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -14,8 +14,8 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess;
public partial class Origin : OriginAccess public partial class Origin
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]

View File

@ -14,8 +14,8 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess;
public partial class Origin_Exam : OriginAccess public partial class Origin_Exam
{ {
public int Origin_ExamId { get; set; } public int Origin_ExamId { get; set; }

View File

@ -14,8 +14,7 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess; public partial class Patient
public partial class Patient : PatientAccess
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]

View File

@ -14,16 +14,15 @@ namespace EHEC_Server
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using EHEC_Server.DatabaseAccess;
public partial class Result
public partial class Result : ResultAccess
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Result() public Result()
{ {
this.Exam = new HashSet<Exam>(); this.Exams = new HashSet<Exam>();
} }
@ -36,7 +35,7 @@ using System;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Exam> Exam { get; set; } public virtual ICollection<Exam> Exams { get; set; }
} }

View File

@ -5,7 +5,6 @@ using System.Runtime.Serialization;
using System.ServiceModel; using System.ServiceModel;
using System.Text; using System.Text;
using EHEC_Server.DataBuilder; using EHEC_Server.DataBuilder;
using EHEC_Server.DatabaseAccess;
namespace EHEC_Server namespace EHEC_Server
{ {
@ -18,6 +17,7 @@ namespace EHEC_Server
Patient dataaccess_patient = new Patient(); Patient dataaccess_patient = new Patient();
Result dataaccess_result = new Result(); Result dataaccess_result = new Result();
Origin dataaccess_origin = new Origin(); Origin dataaccess_origin = new Origin();
Origin_Exam dataaccess_origin_exam = new Origin_Exam();
Exam dataaccess_exam = new Exam(); Exam dataaccess_exam = new Exam();
public List<Doctor> GetDoctors() public List<Doctor> GetDoctors()
@ -48,7 +48,10 @@ namespace EHEC_Server
{ {
return dataaccess_origin.CreateOrigin(origin); return dataaccess_origin.CreateOrigin(origin);
} }
public Origin_Exam WriteOrigin_Exam(Origin_Exam origin_exam)
{
return dataaccess_origin_exam.CreateOrigin_Exam(origin_exam);
}
public Exam WriteExam(Exam exam) public Exam WriteExam(Exam exam)
{ {
return dataaccess_exam.CreateExam(exam); return dataaccess_exam.CreateExam(exam);