Skip to main content

Posts

Restoring a DB when the database is “In Use”

We’ve all run into this issue before. We have a backup of a database that we need to restore into a DEV/QA environment, but when we attempt to restore, we get the “ System.Data.SqlClient.SqlError:  Exclusive access could not be obtained because the database is in use ” This error can be very frustrating to get around and a person can spend a LONG time trying to kill all of the attached queries/threads. I know I’ve (almost) lost my sanity on more than 1 occasiaion trying to do this. The good news is that I’ve found a simple/easy way to restore a backup when the database is in use Steps: Setting the database to single user (you!) restore the backup set it back to multiuser Here is the SQL Script I use. Simple and fast. Enjoy!

Repository Pattern with Cross Table Objects

  In a recent post, I mentioned one of the advantages of using Entity Framework in your application is that you can build a generic repository class very easily. Of course, its not realistic to think that all access to the data will be a single table at a time. Most often it’s the case where you need to return data that spans multiple tables. I’m  going to show you how I created a simple repository class that spans tables. Creating the Summary/DTO Object The first thing I like to start with is to create the simple POCO object that will be used to transport the data. This is essential to define first so that you do not get caught up in data structures, but instead define the data as the application is going to need it. In the case with my database, I have a table called “Avail” that contains a ton of foreign keys to a contact table. I needed to display this data, but instead of a bunch of foreign keys, I needed to display the actual names of people. etc. I ended up defini...

Showing System message to user when logging in

As part of my role at my company, I’m responsible for deploying code to servers as well as troubleshooting issues with environments as they come up. As a result of this, I’m typically logged into multiple servers at a time. As anyone who does this sort of thing knows, it can be very easy to forget which environment you are in and accidentally modify the wrong server at the wrong time. If this happens to be a production server, the consequences can be catastrophic. Here is a nice little trick I use to make sure that people know which server they are accessing. Remote desktop into the server and open Windows Task Scheduler: On the right hand side in the Actions pane click "Create task:" When the Create task window opens, on the General Tab enter a name: Click on the Triggers tab and click the "New..." button On the New Trigger window, select "At Log on" in the Begin the Task dropdown and make sure "Any User" is selected in the Settings...

Entity Framework -Revisited

I'm starting a new project soon for a new client and I've finally had some time to do some prep work to set up the skeleton of the solution/projects as well as investigate some "new" technologies. One of the things that I've revisited is Entity Framework(EF). I thought a great way to get my blogging going again was to post my thoughts on EF. <gasp> Turns out is not as bad as I thought it was... </gasp> Why I hate(d) Entity Framework: Until 4 weeks ago, I was not a fan of EF. This hate of EF was born out of early adoption of the technology (V1.1) and attempting to implement this in an N-Tier Application. The pain points were many and there were numerous times when we almost put the project on hold for a week while we ripped out all Entity Framework pumping and re-laid L2SQL  Each time the pain of doing so seemed to out weight the benefits and then 2 days later we would uncover something ELSE that would make EF seem even worse. This would then forc...

Definition of Ironic...

I'm triaging defects today and I ran across this defect. I'm still laughing...

TFS 2010

This week Monday and Tuesday I'm spending some time at the Chicago Microsoft Technology Center with AngelaB and a lot of other great expert on TFS/VS 2010. We're working on upgrading TFS 2008 to TFS 2010. I have to say it’s much easier than I even imagined! MSFT was attempting to make the installation so easy that you don't have to read the installation documentation and they have succeeded! Everything is very intuitive. We even brought in our own process template and that was migrated w/o a problem.   Things I’m loving about TFS 2010: Hierarchical Work item types Administration Console Simplified DB model that makes projects much more portable Easy Upgrade/Import from 2008/2005 When it releases, it’s going to be part of the MSDN license Although TFS 2010 is still in beta, the head architect and I have decided that we'll be upgrading to TFS 2010 next week.

Iteration 0

This week is my iteration 0 for the project I’m on. It’s the first project that I’m going to be the lead architect on. This is something that I’ve always wanted to do, so it’s very exciting for me to get my first taste. I have some great people around me and some mentors that I know I can go to for some help when (not if) I need it. The project is a redesign of a client’s public website. The current website is written in Cold fusion and has a shopping cart functionality that is achieved using Comergent. We’ll be redesigning the site using ASP.NET. We’ll be leveraging the functionality of Commerce server 2009 for the shopping cart functionally as well as interfacing with SAP for billing/shipping/product information. On top of that the client is using Interwoven as a Content Management system. We’ll have to build a custom DB that Interwoven can write to and that our Website will query to get non product related information. My biggest problem so far is trying to fit the Agile/SCRUM ...