I have been programming in C# for a while but I was never good at design patterns or applying OOP, which I'm trying to change right now.
The problem I'm having is that I have all my SQL statements in a class called "SQLConn" but now I wan't to split it up into child classes instead.
In my application there is a database and two of these tables "Rules" and "Log".
My idea is to create a child class for each table (that I'm using in my application) and move all the methods to that class and open a new connection.
So, if I have a child class called SQLLog and SQLRules which are child classes of SQLConn is it a good idea that when the user inserts a new rule into the application it creates a new instance of SQLConn.SQLRules and runs "InsertRule()" and it also creates a new instance of SQLConn.SQLLog and runs "InsertLog("User inserted Rule X")?
According to this post Is it better to execute many sql commands with one connection, or reconnect everytime? connection pooling will be activated so there should be no big performance difference.
So, to summarize the question: Is it good to design the SQL classes like: * Parent class: SQLConn - Contains the conncetion information * Child class: SQLLog - Contains the "InsertLog()" method * Child class: SQLRules - Contains the "InsertRule()" method
And if I need both SQLRules and SQLLog in a part of my application should I create two instances, one of SQLLog and one of SQLRules, and call it's respectively methods? Is this a good design?
Best regards, Tomas