C
cbmeeks
I work for a small company that has existing code from several people.
The existing code base is pretty good overall but we do have lots of
embedded SQL, hard-coded this, and other types of garbage floating
around.
One thing I want to do is better separate our data layers with our
business layers. I would like to do that using some type of ORM.
However, here's the deal, I want to do it by hand...ie, the hard way.
Our needs are pretty slim for now so I don't believe this to be a
major problem.
I am looking for suggestions/pointers to accomplish the following:
Say I have a table in my database called Persons. Persons table
contains columns ID, Name, Age.
Now, in C#, I would like to do the following:
Persons p = new Persons();
p.Name = "Chuck U. Farley";
p.Age = 35;
p.Save();
The Save method would create the desired SQL for the insert.
Now, I can mock up something that actually works pretty well. But the
problem is if I decide to change the database column "Name" to
"FullName". I then have to change code, etc.
I use methods to reduce the amount of code changes but I just feel the
whole process could be made simpler.
Any suggestions?
Thanks!
The existing code base is pretty good overall but we do have lots of
embedded SQL, hard-coded this, and other types of garbage floating
around.
One thing I want to do is better separate our data layers with our
business layers. I would like to do that using some type of ORM.
However, here's the deal, I want to do it by hand...ie, the hard way.
Our needs are pretty slim for now so I don't believe this to be a
major problem.
I am looking for suggestions/pointers to accomplish the following:
Say I have a table in my database called Persons. Persons table
contains columns ID, Name, Age.
Now, in C#, I would like to do the following:
Persons p = new Persons();
p.Name = "Chuck U. Farley";
p.Age = 35;
p.Save();
The Save method would create the desired SQL for the insert.
Now, I can mock up something that actually works pretty well. But the
problem is if I decide to change the database column "Name" to
"FullName". I then have to change code, etc.
I use methods to reduce the amount of code changes but I just feel the
whole process could be made simpler.
Any suggestions?
Thanks!