piping in a file to SQL Server 2005 on the command line

Thursday, July 30th, 2009

This makes managing SQL server so much easier - especially when you have a HUGE sql file to run and enterprise manager won’t even open it for you!

SQLCMD/? will give you all the options available.

An example of piping in a file to a defined instance using a a username and password:

SQLCMD -S localhost\SQLSERVER2005 -U username -P password -i sql-file-to-run.sql

easy peasy! Just make sure the user you are logging in as has all of the permissions required to perform all of the actions in the sql file! (watch the console output!)

Testing IE gets a little easier

Thursday, July 30th, 2009

http://www.my-debugbar.com/wiki/IETester/HomePage

Castle ISessionFactory can be resolved outside of a web request

Wednesday, July 15th, 2009

I found this very useful today. I have a Quatz Job running that requires access to a repository. This repository is usually resolved by castle like so:

var repository = Registry.Get<MyRepository>();

In the case I have I cannot do this as ‘MyRepository’ depends on having an ISessionManger injecting into it but in this context one does not exists. What I found out though (thanks to Thom) was that I can simply ask the container for an ISessionFactory like so:

var sessionFactory = Registry.Get<ISessionFactory>();

Now I can create a class that implements ISessionManager and instantiate my repository with this - top stuff!

Now I have found this I will be changing how my integration tests work!

testing sending emails .NET

Friday, July 10th, 2009

At first I thought this may be tricky but as it turns out I am not the only one ever to have this problem!

First of all you can try and use the SpecificPickupDirectory. This tells the smtp client to simply drop the message into a desegnated directory:

http://dotnettipoftheday.org/tips/smtp-delivery-method-SpecifiedPickupDirectory.aspx

<system.net>

<mailSettings>

<smtp deliveryMethod=”SpecifiedPickupDirectory”>

<specifiedPickupDirectory pickupDirectoryLocation=”c:\Test\” />

</smtp>

</mailSettings>

</system.net>


If that does not float your boat then you can take it a stage further:

http://haacked.com/archive/2006/05/30/ATestingMailServerForUnitTestingEmailFunctionality.aspx

Another useful tool is this: http://www.codeproject.com/KB/IP/despop3client.aspx