Archive

Posts Tagged ‘Sql Server’

Simple Linq to Sql Enhancements with T4 Templating

October 23rd, 2009

I sometimes underestimate the power of the tools that come with visual studio. Usually this is because I’m ignorant of the fact they even exist until I see them used or read about them somewhere else. T4 text generation is no exception.  This is a very useful tool that’s built right into Visual Studio 2008 which I discovered while peeking at the new SubSonic 3 code when it came out. (Thanks Conery). :)

After spending a day drilling into T4 and learning how it works, I have to say that it was definitely time not wasted. I’ve since used it for tons of miscellaneous code generation projects including mostly data layer extensions. And with the help of the data provider specific templates in the SubSonic project, much of the schema extraction code has been provided for us through open source.

I’m a big fan of SubSonic, and I like to push it in all the shops I work with that aren’t already anchored down to another data framework. However, sometimes we still have to fall back to vanilla data layers like Linq to Sql (L2S), Entity Framework (EF), or straight up ADO.Net depending on the shop and its personalities. Having experience using SubSonic opens your eyes to some useful ways you can improve L2S and the others.

Read more…

Nathan Bridgewater T4 , , ,

Connecting to Sql Server using Impersonation from Asp.Net

June 16th, 2009

So you have an Asp.Net application that needs to authenticate its users to Active Directory, and you also want to use their credentials for connecting to a database server. It’s pretty logical thing to do in an enterprise environment where you would normally control all your user privileges using Active Directory. This is especially nice since you also don’t have to put sensitive credentials in your web.config file. Read more…

Nathan Bridgewater .NET, ASP.Net, Sql Server , , , , ,

Fixing a Corrupt Sql Server 2005 Install

April 13th, 2009

Okay, so I’ve been fighting with this workstation that has a corrupt Sql Server 2005 install, and I’m unable to re-install or remove the old install. I’ve tried manually removing registry keys and the whole nine. I even found a few references to articles posted about the topic.

I finally figured it out, so I thought I’d share since I’ve had to do this more than once. My situation is that I have a machine with Sql Management Studio Express installed and I needed the full Management Studio installed. So while uninstalling a few components, I must’ve done it in the wrong order, my Sql Server Add/Remove just disappeared.  So then I was unable to cleanly uninstall the software.

When I tried to re-install the client components, I kept getting this error:

A component that you have specified in the ADD_LOCAL property is already installed. To upgrade the existing component, refer to the template.ini and set the UPGRADE property to the name of the component.

sqlerr

Sounds a bit greek to me.  But after a few minutes of reviewing google results for the subject, I found this article.

http://www.techtalkz.com/microsoft-sql-server/163115-uninstall-sql-2005-studio-express-so-i-can-install-sql-2005-t.html

In the last post, he mentions that he downloaded the Windows Installer Cleanup Utility and it worked.  So I thought I’d give it a whirl since my local install was pretty much a handful of nastiness.  So I downloaded the utility from Microsoft’s web site.

After installing, I ran the utility, found the missing add/remove items and removed them.  Easy peasy…

Finally I restarted the Sql 2005 installer as normal, and the Client Components install went through without a problem.

Now I can get some work done…

Nathan Bridgewater 2005, Sql Server , ,