Visual Studio 2008 SP1 (and TFS2008 SP1) is here as promised

August 11, 2008

In the last post I hinted that the Visual Studio 2008 SP1 RTM would be available today.

It is required by the SQL Server 2008 when you want to install it on computers with Visual Studio 2008. Be sure to install the VS2008 SP1 before installing SQL Server 2008 on the same machine.

Of course, besides SQL Server 2008 support, Visual Studio 2008 SP1 includes lot’s of other exciting features like ADO.NET Data Services, ASP.NET Dynamic Data, Entity Framework (loved by many, hated by even more;) ) and much more.

You can read about the new SP1 features from here. Oh, and the SP1 for the TFS 2008 is also available :) )

Here are the links to the downloads:

Microsoft Visual Studio 2008 Service Pack 1 (exe)
http://www.microsoft.com/downloads/details.aspx?FamilyID=fbee1648-7106-44a7-9649-6d9f6d58056e&DisplayLang=en

Microsoft Visual Studio 2008 Service Pack 1 (iso, stand-alone, 831MB)
http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5-4c67-bd99-84e525b5ce61&DisplayLang=en

Team Foundation Server 2008 Service Pack 1 (exe)
http://www.microsoft.com/downloads/details.aspx?FamilyID=9e40a5b6-da41-43a2-a06d-3cee196bfe3d&DisplayLang=en

Here are other related downloads (Remote Debugger etc):
Search From Microsoft Download Center

Credits for notifying about the update goes to johnrummel, thx :)

Updates:
SQL Server Express Edition is also available! (thx, wisemx)

Guy Burnstein has also a nice list of downloads in his blog.


Stored Procedures vs. Dynamic SQL – The never ending debate?

January 6, 2008

One of the recurring discussions among developers of data-driven applications is the choice between stored procedures and dynamic SQL.

Last time I stumbled upon this subject was when I started reading this post about NHibernate at Karl Seguin’s blog. Years ago one of the longest discussion was caused by this post from Frans Bouma. This is an another typical post about the subject I saw today.

I’m not going to start another rant about which is the right choice for everything, as there simply isn’t any ultimate answer. Deep Thought could argue with this, but the answer would probably take millions of years, so who cares. ;)

Use object-relational mapping for the generic stuff

My recommendation is to use dynamic SQL for the most database access methods (say, 80-90%), when coupled with a solid object-relational mapping tool or some code generation tool.

Especially with large databases that have many tables it wouldn’t be wise to code all the SQL by hand (sprocs or inline). Add tight schedules and changing requirements/database schemas and long days are guaranteed.

Usually majority of the data-access methods for normal, transactional databases are basic CRUD-operations, so why bother coding sprocs when they don’t bring any advantages?

Better choice is to use LINQ, Entity Framework or a good third-party object-relational mapper to reduce routine coding and to get lazy-loading etc.

Use stored procedures for the heavy stuff

No matter how useful OR-mappers can be, I still think that for the rest of the data access (the remaining 10-20%) stored procedures are a better option.

For complicated queries like searches and reports you often need more sophisticated SQL than what the generic tools can generate. I’m talking about queries or updates that span many tables, aggregate data or those that would require lots of round-tripping when using dynamic SQL and other client-side alternatives.

Of course you can combine all the data from automatically generated collections, but it would mean very chatty way to collect the data. With sprocs you can often get all the required information in one access to the database.

In cases like these it is better to fire up the good old Management Studio (or Query Analyzer) and optimize the queries for better results. While tuning, you can easily check the Execution Plans, index usage and logical reads (with STATISTICS IO option on).

I’m not saying that stored procedures are always automatically faster than similar dynamic SQL-clauses (they are not). My point is that manual tuning SQL by hand brings more performance as long as you know what you are doing. Crappy SQL in stored procedures (cursors, temp tables etc) won’t bring any benefits. Also, business logic belongs to the business logic layer.

When you notice that some part of the application is performing slowly, moving and optimizing that part of the code as a stored procedure could help. SQL Server Profiler is a good tool for finding slow-performing queries.

Conclusion

Like with almost everything, choosing the right tool for the right job applies here as well. Better get the best of both worlds than choosing blindly one over other.

For normal (CRUD) database operations, use object-relational mapping. However, make sure that the tool can use sprocs when needed or write helper classes for sproc-access manually as sometimes it is better to optimize the queries manually.


Entity Framework Beta 2 & Tools CTP1 released!

August 28, 2007

While browsing through feeds, I spotted these news - Entity Framework Beta 2 is now available for download.

I believe that once Entity Framework is ready, it’ll work sweetly with the LINQ to Entities. That way you’ll get best of both worlds. The figure on the right (copied from the MSDN) describes the architecture and relations of the Entity Framework, LINQ and ADO.NET well.

image

The new features and improvements in the Entity Framework include:

  • Events to customize code generation
  • Abstract types in EDM models
  • Complex types
  • <Using> support in metadata files
  • Entity key serialization
  • Increased persistence ignorance in entity data classes
  • Improved connection management in ObjectContext
  • Improved DataBinding usability
  • Metadata annotations
  • Better support for span over LINQ to Entities queries
  • Improvements to LINQ queries: additional canonical functions and automatic mapping from CLR functions to server functions
  • A new event for extensibility of SaveChanges
  • Usability and consistency improvements
  • Polymorphic results from stored procedures

If you are interested in trying out this beta, be sure to test the tools (CTP1), too. The tools will bring you the joys of Entity Designer, Entity Mapper, Entity Model Browser and Visual Studio Integration.

Other useful links:

I’ve been bit busy lately due to moving to new apartment this week and otherwise busy, so there haven’t been lately as much time for blogging as I have hoped. It’ll be fixed soon, though :)