Highway.Data Drivers Ed: Getting Started Video

The Highway.Data Team has just published a great video explaining the concepts and usages that you need to understand to get you up and running quickly.  The Highway.Data Drivers Ed series is designed to help answer many of the questions that the team has received or encountered ourselves.  It will cover basic to very advanced usages.

This Episode 3 in the series contains information about the following:

  • Patterns: 0:00
  • Getting Started: 3:16
  • Queries: 7:01
  • Scalars: 10:21
  • Commands: 14:22
  • Advanced Queries ( SQL based, and Projections): 16:58
  • Eager Loading: 20:56
  • What is IDomain?:22:22
  • Testing with Highway: 27:17
Highway.Data Drivers Ed Episode 3

Add Category Picker to Outlook 2010 New MailItem Ribbon

Recently I have started using Outlooks Categories to organize my emails.  It has made like much easier, I set a category on the received email, move it to the archive.  I have created custom search folders that look for that  category.  That way no matter where the email is it always shows up in the search results.  Except for outgoing emails.  I have to go into the Sent folder and set the category.  So, I set out to figure out if  I could set the category before I send the mail, thus saving me a step.

I found the following information on SuperUser.com in the thread In Outlook 2010, can you add “Categories” to the “New Email” Ribbon? 

Create a Macro, because believe it or not Outlook doesn’t not have the Category button available when you try to customize the ribbon.

  1. Open the Visual Basic Window (ALT + F11)
  2. Add a Module (Right-click “Modules” folder –> Insert –> Module
  3. Copy the following code into the module

    Public Sub CategoriesButton()
    
         Dim Item As Outlook.MailItem
    
         Set Item = Application.ActiveInspector.CurrentItem
    
         Item.ShowCategoriesDialog
    
    End Sub

  4. Close the editor

Now to add the macro to the menu

  1. Click the “New E-Mail” button
  2. Right Click –> Customize Ribbon –> Drop Down –> Macros –> Select “Project 1.CategoriesButton and add to a new group.
  3. Rename the group, and Menu item and add Icons if you wish

Thanks QBIK for posting this for all to enjoy.  I am posting to make it easier for me to find this in the future.  Thanks again QBIK.

Add ?Sleep command to Executor

I searched StackOverflow and Google to find out to set my laptop into Sleep mode from the command line.  There were tons of solutions and tones of failures.  I wanted to keep a record of the one the worked for me so here it is.

I wanted to add a ?Sleep command to my favorite launcher application Executor from http://executor.dk.  Like I said earlier there are a lots of opinions about how to do this.  I choose to use SysInternals psshutdown command.

So, I added a new keyword ?sleep with the following parameters:

Command: c:\_path_to_sysinternals\psshutdown
Parameters: –d –t 0
Open as: hidden 

Now I just fire up executor with my shortcut and type ?sleep and enter to set my laptop into sleep mode.

Others say that without turning hibernate off it does a deep sleep and takes longer to restart and will not restart with any key but only the power key.  Not sure about the deep sleep but I do have to kit the power key to wake the laptop up.  I am ok with this since I tend to hit keys on the keyboard when I don’t intend to.  Make the wake up process more intentional.

HwyFwk: Dynamic Database Connection String

In Highway.Data you must specify the connection string to be able to access the database.  Use the following approach to allow you to specify the connection string in the web.config and utilize Web Config Transformations to target the correct database for each environment.

Modify the Install method in /Installer/HighwayDataInstaller.cs

   1:  public void Install(IWindsorContainer container, IConfigurationStore store)
   2:  {
   3:      container.Register(
   4:          Component.For<IDataContext>().ImplementedBy<HighwayDataContext>()
   5:              .DependsOn(new
   6:              {
   7:                  connectionString = @"Data Source=.;Initial Catalog=ChangeMyConnectionString;Integrated Security=SSPI;"
   8:              })
   9:              .LifestylePerWebRequest(),
  10:          ...
  11:          );
  12:  }

To

   1:  public void Install(IWindsorContainer container, IConfigurationStore store)
   2:  {
   3:      container.Register(
   4:          Component.For<IDataContext>().ImplementedBy<HighwayDataContext>()
   5:              .DependsOn(new
   6:              {
   7:                  connectionString = ConfigurationManager.ConnectionStrings["KEY"].ConnectionString
   8:              })
   9:              ...
  10:          );
  11:  }

By using the ConfigurationManager you can specify which connection string from the web.config to use.  Now just set up the Web Config transformations for each environment you deploy to and your are good to go.

HwyFwk: Disable Database Initializer for Database First Approach

Highway.Data configures a Database Initializer out of the box.  Unfortunately where I work does not allow developers to create databases on our development data server.  We usually start our development with an already formed database.

To disable migrations do the following files:

  1. Delete /App_Start/DatabaseInitializerWireup.cs
  2. Delete /Config/HighwayDatabaseInitializer.cs
  3. Edit /Installers/HighwayDataInstaller.cs and remove the registration for IDatabaseInitializer

There you go, Highway.Data will not try to drop and re-create your database now.