Joel Hainley : San Francisco Bay Area Software Consultant

  • rss
  • Home
  • About
  • Reading Lists
    • 2008 Reading List
    • 2007 Reading List
    • 2006 Reading List
    • 2005 Reading List
    • 2004 Reading List
    • 2003 Reading List
    • 2002 Reading List
    • 2001 Reading List
    • 2000 Reading List
    • 1999 Reading List
    • 1998 Reading List
  • Software
    • mcalc - a tournament poker utility
    • Joel’s "Super Fancy"(tm) Maximum Heart Rate [MHR] Worksheet

Adventures in ORM on .NET 3.5

December 26, 2008

I’ve been working on a project in .NET 3.5  and  Adobe Flex 3 and have been having a good time getting the base architecture in place. I’ve spent the last couple of weeks looking at two ORM technologies available in .NET. NHibernate and LINQ for Entities. 

I started started out working with NHibernate because I was familiar with Hibernate in the java world. Well actually, I was familiar with the Repository from ATG which is pretty similar to Hibernate. (My general impression is that ATG’s Repository is a bit more polished than Hibernate) NHibernate worked out great and very quickly I was able to get the database access up and running and had a working prototype. Once this was done, I did some more digging to see what other ORM implementations were available for .NET.  There are quite a few projects out there but I came across LINQ, and specifically LINQ for Entities.

LINQ could probably best be described as a generalized approach at data access from various datasources that is intended to replace all of the customized query languages/approaches ( SQL, XPath, iteration through various collection classes, etc ) with a single language. Ostensibly this will reduce the amount of stuff a developer needs to know to be effective. According to the available documentation LINQ for Entities is the most customizable implementation of ORM functionality available in LINQ. There are some other ways to do similar things with a little less control using LINQ to SQL but I decided to just dig deep as the sort of control I was used to with Hibernate was most similar to LINQ for Entities.

I had to upgrade Visual Studio 2008 to sp1 to use LINQ for Entities, but this was trivial and I soon had things up and running. In short order I had everything working with LINQ and the application was moving forward again. At this point I’m mostly impressed with LINQ and I think I’ll end up using it for this project. There are a bunch of tools available in the IDE to support the mapping operations, and it will autogenerate initial classes by simply pointing the IDE at the database you are using.

I’m not sure if LINQ is the be all end all that microsoft is hoping it will be. I’m not convinced that a generalized query language is needed. It has been said, by several philosophers and more than a couple of programmers, that the language that you have available to express yourself has an impact on your thinking. In this case specialized languages such as XPath and SQL give your mind a set number of ways to express yourself that are consistent with the underlying implementation. Yet a generalized approach abstracts that away and removes you another step farther away from the realities of the toolset you are using. Is this a good thing? Time will tell and at the very least it will be interesting to see how far people can take this approach to querying various datasets. 

The thing I am convinced about is that ORM technology is making it much easier on developers to quickly and easily get database code up and running. The increases in productivity are real. It is nice to interact with the data as objects instead of as sql queries, stored procedures, etc. Somehow I suspect that the Smalltalk crowd is sitting in the wings chuckling at all of the other technology platforms touting their ORM solutions.

Comments
No Comments »
Categories
.NET
Tags
ATG, LINQ, NHibernate, ORM, Repository
Comments rss Comments rss
Trackback Trackback

A quick note about .NET Web Services, Adobe Flex and Namespaces

November 1, 2008

I was building out some .NET based web services for a Flex project I’ve been working on and bumped up against something that gave me a bit of trouble. When you create a .NET Web Service there is a namespace attribute associated with the service. Here’s an example (in c#) :

namespace HelloWebService
{
[WebService(Namespace = "http://www.examplenamespace.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]

public class Service1 : System.Web.Services.WebService
{

// implementation …

}

This value is required by .NET for a web service, or at the very least .NET gets VERY upset if this value is not set.

You will then need to let Flex know about this namespace in order to access the results. To do this you simply add the following lines to Flex:

private namespace lh = “http://www.examplenamespace.com/”;
use namespace lh;

Not much to it, but it can be a bit of a pain when you’re not aware of this. Flex doesn’t complain, it just gives you empty values when you try to access the values.

Comments
No Comments »
Categories
.NET, c#, flex, programming, web services
Tags
.NET c# webservices web services flex
Comments rss Comments rss
Trackback Trackback

Navigation

  • .NET
  • 30-Day-Challenge
  • Amateur Radio
  • bicycle
  • books/reading
  • business
  • c#
  • cackl
  • Exercise
  • flex
  • friends
  • hamtesting.com
  • knuth
  • lectures
  • life
  • observations
  • people watching
  • personal finance
  • philosophy
  • php
  • picprep
  • programming
  • reading
  • santa barbara
  • scheme
  • school
  • seo
  • uISV
  • Uncategorized
  • web services
  • website

Search

Archives

  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • November 2007
  • October 2007
  • September 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • January 2007
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006

Site Pages

  • About
  • Reading Lists
    • 1998 Reading List
    • 1999 Reading List
    • 2000 Reading List
    • 2001 Reading List
    • 2002 Reading List
    • 2003 Reading List
    • 2004 Reading List
    • 2005 Reading List
    • 2006 Reading List
    • 2007 Reading List
    • 2008 Reading List
  • Software
    • Joel’s "Super Fancy"(tm) Maximum Heart Rate [MHR] Worksheet
    • mcalc - a tournament poker utility

friends

  • Ashley McNamara Photography
  • Colin McNamara

my websites

  • HamTesting.com
  • Photos
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox