Backward Compatible-Issue PrefC.GetString & PrefC.GetInt

This forum is for programmers who have questions about the source code.
Post Reply
technosoft
Posts: 11
Joined: Thu Nov 01, 2018 4:37 am

Backward Compatible-Issue PrefC.GetString & PrefC.GetInt

Post by technosoft » Mon Dec 03, 2018 7:13 am

Hi Guy's,

We have developed a plugin using v16.4 OpenDental. Now, we're testing plugin with v17+ & v18+. Suddenly somehow it starts throwing the following message.

Method not found: 'System.String OpenDentBusiness.PrefC.GetString(OpenDentalBusiness.PrefName ...

Code: Select all

           
string _result = OpenDentBusiness.PrefC.GetString(PrefName.EmailInboxComputerName);
return _result;
OR

Code: Select all

int _result = OpenDentBusiness.PrefC.GetInt(PrefName.EmailInboxCheckInterval);
I have seen the code and it seem OpenDental still using it the same way.

Such as:
FormApptProcs.cs Line 158 (v18.3)

Code: Select all

ProcCur.DiagnosticCode=PrefC.GetString(PrefName.ICD9DefaultForNewProcs);
Suggestion please?

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Backward Compatible-Issue PrefC.GetString & PrefC.GetInt

Post by jsalmon » Mon Dec 03, 2018 10:30 am

There was a couple of versions where large customers were having significant slowness with caching data and we had a temporary bug fix in place that took an optional parameter (dictionary of prefs). The bug was finally fixed the correct way and the optional parameter was removed. Thus you need to simply recompile your plug-in with the updated OpenDentBusiness project / dll.

From the compiler's perspective the only method that exists (in your version of OpenDentBusiness) is PreC.GetString(PrefName,Dictionary). Once you recompile with the new reference then the compiler will see PrefC.GetString(PrefName).
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

technosoft
Posts: 11
Joined: Thu Nov 01, 2018 4:37 am

Re: Backward Compatible-Issue PrefC.GetString & PrefC.GetInt

Post by technosoft » Tue Dec 04, 2018 6:29 am

Hi salmon,

We did that and tried to compile the plugin with the latest version. Though we're using multiple functions from Business layer such as "Appointments.SetAptStatus". function parameters have been changed.

v18.3

Code: Select all

public static void SetAptStatus(Appointment appt, ApptStatus newStatus, bool suppressHistory = false);
v16.4

Code: Select all

public static void SetAptStatus(long aptNum, ApptStatus newStatus);
There is a possibility that our multiple clients are using a different version. They will have different business layers, right?
How do you think is the best approach to maintain backward compatibility. Should we stop using the business layer?

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Backward Compatible-Issue PrefC.GetString & PrefC.GetInt

Post by jsalmon » Tue Dec 04, 2018 9:47 am

technosoft wrote:There is a possibility that our multiple clients are using a different version. They will have different business layers, right?
That is correct.
technosoft wrote:How do you think is the best approach to maintain backward compatibility. Should we stop using the business layer?
Open Dental does not honor backward compatibility standards at the moment so the best thing to do is have specific versions of your plug-in that follow the versioning of Open Dental so that your users know which versions of Open Dental are officially supported. See the DLL Naming section on the Plug-in Framework page in our manual for more information on versioned dlls. I always recommend utilizing our business layer because we will often times implement a new feature and update the guts of our methods to use the new paradigm. If you were to duplicate the logic within your plug-in you run the risk of your code continuing to "work" (not crash) but not function as desired within the program (e.g. you might be inserting data into a deprecated column in the db).
https://www.opendental.com/manual/plugins.html
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

Post Reply