Re: Better n-tier suggestions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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!



.



Relevant Pages

  • Re: Better n-tier suggestions
    ... Even if you can't use LINQ to SQL, there are other options to make your ... major problem. ... problem is if I decide to change the database column "Name" to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Are Linq-SQL methods commutative
    ... No - in LINQ each step effectively works off the result of the ... linq query which has to meet a SQL query they have in mind. ... freedom a SQL statement gives them: the SQL statement is the one ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: LINQ Where 1=0
    ... The LinqDataSource control stores values for all primary keys ... Before LINQ to SQL updates or deletes data, it checks the values in view ... If the underlying data source contains a timestamp field that is ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Why cant recursive queries contain...?
    ... imagine that you have a gross amount of data spread ... SQL, and the optimizer will make sure that you get a new query plan as ... If you really think the limitation of 8000 chars gets in your way, ... The analogy was not meant to denigrate LINQ ...
    (microsoft.public.sqlserver.programming)
  • Re: Microsofts bridge between OO and relational
    ... Test Drive VB9 and DLinq ... The January 2006 Language Integrated Query (LINQ) preview for the next ... VB.NET, SQL Server 2005, XML, Visual Studio 2005, ... Without reading it all and accepting that a domain is nothing but a data type it has seemed to me a retrograde kind of introspection, even bizarre, to first make relations out of domains, then turn around and make those relations into data types. ...
    (comp.databases.theory)