Extensions Methods

All these extension methods are now contained here https://github.com/chrismckelt/ExtensionMinder and available on nuget at https://www.nuget.org/packages/ExtensionMinder/

July 2009 · Smart Tech

Winforms UI cross thread operations

ThreadPool.QueueUserWorkItem(new WaitCallback(LoadUsers)); private void LoadUsers(Object stateInfo) { var site = new SPSite(testHarnessSettings.Url); var web = site.OpenWeb(); foreach(SPUser user in web.AllUsers) { if (usersListBox.InvokeRequired) { usersListBox.Invoke( new MethodInvoker( delegate { usersListBox.Items.Add((user.LoginName)); })); } }

February 2009 · Smart Tech

How to use DB Deploy

Here is a quick example of how to use DB Deploy This example uses NANT to run DBDeploy which in turn generates the output.sql file. This is then run against the database causing our changes to be run in and putting an entry in the ChangeLog table to tell you which sql files have been run. To run this sample Download to a location on your computer e.g. C:\Examples\DBDeployExample Create a database onyour localhost called DBDeployExample In a command prompt (Or PowerShell) use NANT to build the solution –(I have this setup as an environment variable setup and simply type ‘NANT’) NANT will build the default.build file and run the database changes Opening the solution file looks like this ...

August 2008 · Smart Tech

Impersonation in Microsoft Dot Net

Usage string domain = "ExampleDomain"; string userName = "ExampleUserName"; string password = "ExamplePassword"; using (Impersonation impersonation = new Impersonation(domain, userName, password)) { // impersonation occuring in here Console.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name); } Implementation

July 2008 · Smart Tech