How to set an Orchard CMS module to be home page with code

This will work for Orchard CMS Version 1.8.

  • Create a new module
  • Create a Routes.cs file in the module
  • Set the RouteDescriptor priority to something high like 99
  • Set the new route url to be an empty string

Here’s some example code for Routes.cs

Continue reading

EntityType has no key defined. Define the key for this EntityType

While running “Add-Migration” I kept receiving the following error in a new ASP.NET C# project using Entity Framework.

Ebs.Job.Models.JobListing: : EntityType ‘JobListing’ has no key defined. Define the key for this EntityType. JobListings: EntityType: EntitySet ‘JobListings’ is based on type ‘JobListing’ that has no keys defined.

The code in question was the following:

The answer is that as of 6/12/2014, Entity Framework does not support unsigned integers. Once I changed the UInt32 to Int32, everything worked great.

Continue reading

Visual Studio using old app.config value or setting

Once in a blue moon, I will run into a problem with Visual Studio 2012 where the App.config for a console application is getting cached somewhere and there’s no way to release it. So the App.config is stuck with old values which aren’t correct for the application today. It’s happened maybe twice this year to me.

The App.config in my solution shows the correct values. The one that’s been put in the output directories for Debug and Release both look good, but my quick little console application is pulling ghost values from an App.config from last week. I’ve tried building, rebuilding, and finally, all to no avail.

The only thing I could think of to fix this ( which did work ) was:

  • Copying the contents of the App.config file from within Visual Studio
  • then delete the file from within Visual Studio
  • Then re-add the config file
  • Then paste in the contents.
  • Rebuild and run.

I’m going to chalk this one up to ghosts in the machine.

Continue reading