Geeks With Blogs

News Please visit me at my new blog!!

profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Programming and Learning from SD December 2012 Entries
Quick Test for Entity Framework DBContext

A co-worker wrote this and we think it is useful.

Posted On Friday, December 28, 2012 2:41 PM

MVC 4 string.cshtml override
In order to get placeholder or maxLength or other Html attributes to work with the Html.EditorFor methods, you need to create an override file in Views\Shared\EditorTemplate... @{ // make placeholder work // // from [Display(Prompt = IDictionary<string, object> attributes = new Dictionary<string, object>(); if (!string.IsNullOrEmpty(View... { attributes.Add("placeholder", ......

Posted On Wednesday, December 19, 2012 9:41 AM

SignalR Hubs Service
I created an almost generic approach to interacting with the SignalR hubs. I had to use a string with if statements in the hubFactory method to create the correct hub that matches the name on the server. namespace is defined globally as var namespace = namespace || {}; /*global namespace, $ */ /// <reference path="../jquery.signalR-0.5... /> // file: Scripts\custom\HubsService.js // // summary: All SignalR hubs interaction will go through this class so that the classes can be testable. namespace.HubsService ......

Posted On Tuesday, December 18, 2012 8:26 AM

WebAPI Dependency Injection
If you try to dependency injection into a constructor with WebAPI, you’ll get an exception that says you need a parameter less constructor. The same is true for MVC controllers, but that is a different topic. Microsoft contains a good guide on how to get this working. There is also a useful StructureMap.DependencyReso... nuget package by statish860 that does it for you. Get the nuget package, then add GlobalConfiguration.Configu... = new DependencyResolver(ObjectFa... ......

Posted On Friday, December 14, 2012 10:29 AM

Free Exam Voucher for 70-480 with Training Available
Go to get the voucher before March 2013 and before they run out.EDIT: ** I just heard from a co-worker and a comment from a reader that they HTMLJMP promotion code is no longer working. My co-worker said he thought they ran out. ** February 21st, 2013. You can still get a second chance as long as that is still valid.EDIT: 3 for 1 offer until May 31, 2014: http://www.microsoftvirtual... ......

Posted On Thursday, December 13, 2012 8:52 AM

Mocking or Faking DbSet
I needed to Fake the DbSet of a DBContext in EF 5 so that I could test my caching implementation. I searched for awhile and found this link on creating an in memory DbSet. I first copied the code in and created an InMemoryDbSet class. Then I changed all my DbSets in my DBContext to IDbSet. Then I was able to mock the call to UserProfiles and return a dummy object. The Test I’m using FakeItEasy which is a nuget packages. Notice the usage of the InMemoryDbSet<UserProfil... [TestInitialize] public ......

Posted On Wednesday, December 12, 2012 11:14 AM

Copyright © Aligned | Powered by: