Use Generic Data Access for other classes

This forum is for programmers who have questions about the source code.
Post Reply
fcarlier
Posts: 75
Joined: Tue Jun 19, 2007 3:12 am
Location: Ghent, Belgium

Use Generic Data Access for other classes

Post by fcarlier » Mon Oct 08, 2007 8:56 am

Hello,

Would there be any objections if I'd "convert" more classes (e.g. Patient) to use the data access framework? The imaging-related classes use this framework already, and if I'm correctly there haven't surfaced any problems related to this.

"Converting" classes would always go hand-in-hand with adding unit tests to make sure they are correctly supported by the data access framework.

I'd like to make another compelling argument for using this framework. If you use it, you'll get a clear view of the Open Dental code that deviates from "standard" CRUD operations. That may make it easier to use, for example, the ADO.NET Entities Framework when it comes available (somewhere in 2008), which would simplify data access.

Frederik.
Frederik Carlier

User avatar
jordansparks
Site Admin
Posts: 5744
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 7:21 pm

Wow! I hadn't hear about the ADO.NET Entities Framework before. I'm very excited about it. This could really boost speed of development. So yes, I strongly support this change. I have to confess that I will really miss the simplicity of the current 'TableType' classes. I frequently dive into them to look up the meaning of a particular table column. Did you notice how I altered the white space of the Document class to try to retain some of this utility? I tried to write a macro to automate this whitespace rearrangement, but did not have time to learn enough about macros. I'm not asking you to write that macro; I know that if I want it I will have to write it. But if you happen to have some experience with macros, and if you have a few moments, would you consider throwing me a few hints on how to approach it? At least I take comfort in the knowledge that I can always write the macro after the fact to clean up the white space for all the TableType classes in one fell swoop. That's a long way of saying, "Yes. Let's go for it."
Jordan Sparks, DMD
http://www.opendental.com

fcarlier
Posts: 75
Joined: Tue Jun 19, 2007 3:12 am
Location: Ghent, Belgium

Post by fcarlier » Tue Oct 09, 2007 9:25 am

If I understand it correctly, you want to group all the fields & properties together, and seperate these groups of field/property with a single, blank line.

I'll just update the current macros to do that. The changes to these macros should give you some hints on how to get started. Will that do?
Frederik Carlier

User avatar
jordansparks
Site Admin
Posts: 5744
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Tue Oct 09, 2007 10:32 am

I really appreciate it.
Jordan Sparks, DMD
http://www.opendental.com

fcarlier
Posts: 75
Joined: Tue Jun 19, 2007 3:12 am
Location: Ghent, Belgium

Post by fcarlier » Tue Oct 09, 2007 11:40 am

Have a look at Patient.cs. It should be formatted according to your coding guidelines. I also removed the duplicate code comments. They are only present on the Property itself; no longer on the field.

I will now proceed to write the unit tests for the Patient object. I assume that there will be some differences between the data type used in C# and MySQL, I'd like to resolve that.
Once that is done, the goal is to update Patients, so that the generic data access can be used.

If all goes well, I'll move on to other classes.

I'll be busy the coming days, so things will go rather slow.
Frederik Carlier

User avatar
jordansparks
Site Admin
Posts: 5744
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Tue Oct 09, 2007 12:48 pm

It looks really great Frederik. Thanks.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply