Formatting dtsConfig Files

If you write dtsx in SQL Server 2005, often (if not always) you have to make them configurable, in particular if you need to deploy them in various environments (dev, test, staging and production).

Natively the SSMS produces a single-line xml file, so not very readable, but there is a little trick to format them automatically:

  1. open the dtsConfig file
  2. in the editor, right click and "View Data Grid"
  3. expand the grid and make a small modification of a value (for example, add and delete a space)
  4. save the file

Converting Hyper-V Machines

In the past days I've downloaded a virtual machine from Microsoft called Information Worker Demo (now it's downloadable from the page 2010 Information Worker Demonstration and Evaluation Virtual Machine (SP1)).

It's very interesting because it contains:

  • Windows 2008 R2 Standard Edition x64, acting as a domain controller
  • SQL Server 2008 R2 Enterprise with Analysis, Notification and Reporting services installed
  • Visual Studio 2010 Professional
  • SharePoint 2010 Enterprise with FAST Search
  • Office 2010 with Visio and Project

After having downloaded a unrared it, I've got a problem: to run it, you need Windows 2008 R2 with Hyper-V role activated, or the free Hyper-V Server, because Windows 7 cannot run Hyper-V virtual machines.

After some (not easy!) searches on Google, I've finally found this fantastic tool: StarWind V2V Converter, which allows you to convert even Hyper-V machines without the need to run them!

Another (silly) problem: the password of the Administrator account is pass@word1, the keyboard is set to American, to to enter the "@" character... press Shift+2

Refresh in Entity Framework

Entity Framework by default caches the objects retured from the database.
This is convenient, for example, for pseudo-static reference tables, that rarely change and you can accept a restart of your application.

But more times you don't want this, this for example to data updated by multiple front-ends!
So, how can you disable Entity Framework caching?

The solution is:

var query = "some entity framework query"
Context.Refresh(RefreshMode.StoreWins, query);
IList<myEntity> myList = myQuery.ToList();

Having called the Context.Refresh(...) static method before ToList(), makes that the latter one handles correctly inserted and deleted entities, other than updated ones.

You can find a bit more details in the following question+answers page: How to refresh ObjectContext cache from db?.