0

I am looking to get create a partial method to override an auto generated method in linq to sql. From my reading i assume that my method should be used over the auto generated method. if that is the case why am i getting this error? "Type X already defines a member called ZZZ with the same parameter types"

When i run the program the autogenerated method is used instead of my one.

 public partial class HospitalDataContext
{
     partial  void  DeleteHospitalStaff(HospitalStaff staffMember)
    {
        staffMember.Patients.ToList().ForEach(
            patient => DeletePatientCustom(patient.PatientID));

        DeleteStaff(staffMember.HospitalStaffID);
    }
}

Thanks, Tim

Timmy Fuller
  • 75
  • 1
  • 10
  • I assume your auto generated method has an implementation. You can only use a partial method if the other method has no implementation, i.e. partial void DeleteHospitalStaff(HospitalStaff staffMember); Try overriding the method - override void DeleteHospitalStaff(HospitalStaff staffMember){...} – Kamal Aug 21 '14 at 11:06
  • The auto generated method has an implmentation private void DeleteHospitalStaff(HospitalStaff obj) { this.DeleteStaff(((System.Nullable) (obj.HospitalStaffID))); } – Timmy Fuller Aug 21 '14 at 12:26
  • I tried to override the method and I still get the original error. – Timmy Fuller Aug 21 '14 at 12:30

0 Answers0