Posted on March 10, 2008 19:03 by swilliams

Last time, we tweaked our code to make it a little easier to understand and maintain. So that means we get to dirty it up again!  Our current object model has very simple mapping of one table to one class, with no associations between them. In the real world, this doesn't happen too often (and if it does, you are probably doing something wrong). A relational database has relations. Crazy, yes, but it means our model must be able to handle that.

Let's say then, that the Person object can possess all of the TpsReport objects they have created. To represent that, we'll need to update three things, our table structure, the classes, and the mapping file.

More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted on March 5, 2008 08:14 by swilliams

(reposted because something ate this the first time)

Each major release of the .NET framework and Visual Studio has at least one killer feature that makes developers stuck in prior versions pine longingly for it. With .NET 3.5 and Visual Studio 2008, that big one is LINQ. The reason being is that it provides built in OR/M functionality with SQL Server. To put it succinctly: it can take database tables and create .NET classes and the code to bind them to each other.

It's pretty hot stuff, or it is until you look at your business objects and realize that they are directly tied to your data layer. This is known as "Tight Coupling" and is a Bad Thingtm. It is also not very testable - to test anything having to do with your objects will result in the database being modified.

So does this mean we have to chalk up LINQ to SQL as another neato feature that is pretty but only suitable for marketing demos? Not necessarily; there are ways that you can detach the coupling, but it's not the easiest thing in the world.

More...

Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted on March 1, 2008 07:13 by mcollins

Most people make fun of me when I travel.  No matter where we go, or for how long we go for, I always have a travel backpack with me that is filled with books.  Reading is my passion, and I admit that I really love reading books about software topics and learning new things.

One of my latest acquisitions for my library is LINQ in Action by Fabrice Marguerie, Steve Eichert, and Jim Wooley, and published by Manning.  I have to say that at least over the past year or so, Manning has become the best publisher out there.  They fill a niche that I fell that O'Reilly has stepped away from.  O'Reilly used to have the best books in the early days of Java, but then they got caught up in a "publish before it's ready" phase, probably due to competition from Wrox.  Wrox, and this is my opinion, probably has the lowest quality of books of any publisher that I've seen.  Anyways, back to Manning's excellent book...

LINQ in Action is an excellent introduction to LINQ, or Language INtegrated Query, that was introduced with .NET 3.5.  LINQ has promise to completely revolutionize development in .NET to make it easier to interact with data of all sorts.  LINQ provides support for querying and manipulating collections of objects, processing and transforming XML documents, or querying and interacting with persistent data in databases.  To go a step further, LINQ is also extensible to allow developers to add LINQ support to other data sources such as WMI collections, event logs, or other custom data sources.

While I haven't made it all the way through the book, I do have to say that what I've learned about LINQ and .NET through the first few chapters has opened my eyes to a lot of new features of the .NET Framework.  I can't wait to start using them in my own programs and blogging about them here.

Technorati tags: ,


Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5