Re: Better n-tier suggestions
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2008 16:09:25 -0500
With all due respect, it can be made easier, use LINQ to SQL. Doing
something like this by hand for something this simple is just masochistic.
Even if you can't use LINQ to SQL, there are other options to make your
life much, much easier. NHibernate is an option that might be of use to
you.
In the end, if you use something with designer support, it will help
prevent you from having to make these changes by hand when they arise.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"cbmeeks" <cbmeeks@xxxxxxxxx> wrote in message
news:b4392309-0674-48a2-9658-5b9788c1a0ca@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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!
.
- Follow-Ups:
- Re: Better n-tier suggestions
- From: cbmeeks
- Re: Better n-tier suggestions
- References:
- Better n-tier suggestions
- From: cbmeeks
- Better n-tier suggestions
- Prev by Date: Re: Newly getting started in C#
- Next by Date: Re: Multithreaded GC!
- Previous by thread: Better n-tier suggestions
- Next by thread: Re: Better n-tier suggestions
- Index(es):
Relevant Pages
|