Send mail to the author(s) E-mail

# Thursday, 02 October 2014

Decided to bring the prod version of up to v4 (DI, Unit Tests).. as it’s always good to have the latest version in production, and a great way to find all the intricacies of what I did in v3.

Standard tooling now guiding dev’s towards using an email address to login (as well as Facebook OAuth etc..)  I like this.

Forgot password functionality is there behind the scenes.

Ahh the default database it uses to store is… need to change it to .\Projects.SolidJokes

public class ApplicationDbContext : IdentityDbContext<ApplicationUser> {
    public ApplicationDbContext()
        //: base("DefaultConnection", throwIfV1Schema: false) {
        : base("SolidJokes", throwIfV1Schema: false) {

    public static ApplicationDbContext Create() {
        return new ApplicationDbContext();

IdentityModel.cs is where the default connection can be changed, so the db is now SolidJokes (defined in web.config)

Refactor Directory Names

Using a branch called directory, and using R# Refactor, Adjust Namespaces

  • SolidJokes.Core
  • SolidJokes.Tests
  • SolidJokes.Web

Have renamed directories in windows explorer to be as above.

Kept simpler here to avoid clutter

Assembly names are same as directory names in explorer

Slowdown in Debugging

Have noticed a strange delay in debugging, whilst working on: working branch.  So have reverted to master (still the same problem).

If I change to Chrome it works.  However then have an extra keypress (ctrl F5 to finish debugging).  Maybe javascript?  Ahh, attaching the javascript debugger I think.

Looks like just don’t use IE is the best way.

Also took off Edit and Continue.

Maybe fix the js problem!!

Actually can replicate on a new blank project – am getting a 6sec delay where nothing seems to happen.

Tried an update all.  I wonder if this is an IE problem.  Also just installed DevExpress and took off again.  Reinstall of entire OS again?  ie get Win8.1 and IE111

Not passing back querystring from View to Controller

sortOrder is always coming back as the default.  Ahh, its because of my composition.

Looking at SO:

Was simply the decorated logger not passing through.

Update All Packages

The Owin update broke the build.  Used Git to revert back (git checkout – .) and get rid of any untracked files (git clean).  Much tidier


Uses a JokeVoter service

As I haven’t enabled migrations yet in this solution, this blew up when I added Votes to the db model.  A quick hack is to: (this will setup the new db for us)

public Session() : base(nameOrConnectionString: "SolidJokes") {
    // Nice for development - need migrations for this to work
    //Database.SetInitializer(new DropCreateDatabaseIfModelChanges<Session>());

    // Don't need migrations
    Database.SetInitializer(new DropCreateDatabaseAlways<Session>());

Found that my old integration tests rely on the create service (which I haven’t ported across yet).  So lets make these tests less dependant (ie rely on just the IntegrationTestBaseWithData)

Found some unused code in voting – JokeVoterResult.  Going to refactor that soon.


Create and Edit

So now to the meat of the app and get the Create and Edit working.  Will make a diagram slice too, and port over all integration tests.

Got that working and started a new diagram.

Working on a ‘working’ branch in git.


Am not using migrations (in code, but as I’m using it does create the table __MigrationHistory), so I have to keep the db model in sync on prod with .sql files in source control.  Or DB project? is now live with v4!!!

Bugs and Issues

SQL not under source control yet

Delete not doing the delete from Votes if there are any

MVC5 and EF6 so slow to start in debug


MVC5 and EF6 so slow starting in debug

| | #