Dave
Dave

Reputation: 659

Does Codefluent Entities support method overloading?

I want to create 2 methods with the same name, same return type, but different parameters.

When I attempted this using the Model the following happened:

  1. No error message was immediately generated when adding the second method to the model.
  2. The second method did not appear in the GUI for the Model.
  3. Both methods do appear in the XML file generated by the Model.
  4. When I attempt to build the model I got the following error message:

Error 1 CF0075: Procedure '_PR01_PayrollEmployeeFile_LoadBySocialSecurityNumber' for method 'LoadBySocialSecurityNumber(System.String socialSecurityNumber, System.String companyCode)' with body 'LOAD(string socialSecurityNumber, string companyCode) RAW' already exists. Try to change method name or method persistenceName. 0 0 Amikids.DataProWarehouse.Model

Upvotes: 1

Views: 43

Answers (1)

Dave
Dave

Reputation: 659

To the good support people at Softfluent: Give me 24 hours and check back to make sure the following solution fully works and I don't have any other issues.

I think I have the solution but have not fully tested and noticed something quirky in the XML after I did a build, but suspect I may have corrupted the XML file and don't have time to fully explore.

The solution (I think): Set the persistenceName in the XML file. The persistenceName corresponds to the generated stored procedure name.

<cf:method name="TestMethod" body="LOAD(string x) ORDER BY FirstName" persistenceName="TestMethod1" />
<cf:method name="TestMethod" body="LOAD(string x, string y) ORDER BY LastName" persistenceName="TestMethod2" />

Upvotes: 2

Related Questions