Visit site Craig Stuntz's Weblog
December 2011
0
votes
Ad-hoc SQL/POCO Queries in Entity Framework 4.0
Craig Stuntz's Weblog
– Since version 4.0, the Entity Framework has had the ability to query un-mapped data and project it onto POCOs using ad-hoc SQL. Here, for example, is how we check the current SQL Server version: internal class SqlVersionInfo { public string Edition { get; set; } ...
November 2011
4
votes
Sometimes, SELECT Really Is Broken
Craig Stuntz's Weblog
– We got a bug report from a customer the other day; a certain query in one of our web services was giving the following error: A column has been specified more than once in the order by list. Columns in the order by list must be unique. Seems clear enough, except that There was no duplication in ...
October 2011
1
vote
Testing Cross Cutting Concerns
Craig Stuntz's Weblog
– So imagine you’ve been asked to implement the following requirement: When a to-do list item is marked as complete, the CompletedOn date time property shall be set to the current time. That doesn’t sound so hard to implement, but how can I test it? I don’t know precisely what the ...
August 2011
0
votes
Would You Buy a Used Framework from This Tool?
Craig Stuntz's Weblog
– I think the Web Platform Installer is a great tool, but I have to question the wisdom of its home page: If you click on these, you see… nothing. A description would be nice. ("Application Request Routing? What’s that? EC-CUBE?") But that’s not really the problem. The bigger ...
2
votes
Great CS Textbooks, Cheap
Craig Stuntz's Weblog
– I’m probably late to this party, but I’ve discovered that you can find incredible deals on used CS textbooks at Amazon, especially for older editions. For example, I recently ordered a copy of Programming Language Pragmatics, by Michael L. Scott. It’s $63 new for the hardcover or ...
May 2011
8
votes
An Excuse Not to Roll Your Own Authentication Scheme
Craig Stuntz's Weblog
– The Rails 3.1 Release Candidate announcement contained news of many new and useful features, plus these regretful words: has_secure_password: Dead-simple BCrypt-based passwords. Now there’s no excuse not to roll your own authentication scheme. I will briefly provide an excuse. "Simple BCrypt-based ...
March 2011
1
vote
Why Won’t Visual Studio Step Into This Code?
Craig Stuntz's Weblog
– I helped another developer debug an interesting problem this morning. Let’s see if you can spot the problem. The code in question looked something like this simplified version containing only enough code to show the problem: public void Execute() { DoStuff(); // breakpoint 1 } ...
December 2010
0
votes
A Better View API for Grids in ASP.NET MVC
Craig Stuntz's Weblog
– I’m writing a grid-independent interface for displaying data in ASP.NET MVC applications, and I would like your feedback on the API design. In my last post, I discussed some of the problems with existing grid components for ASP.NET MVC. Actually, there are a couple more design issues which I ...
0
votes
One (MVC) Grid to Rule Them All
Craig Stuntz's Weblog
– Imagine you’re starting a new project using ASP.NET MVC. Let’s say it’s a project which frequently requires displaying a list of records, like Google or Stack Overflow or an enterprise database application. Which grid should you use? The obvious answer is, "I don’t know. ...
September 2010
0
votes
How to Avoid Cut and Paste Code with ASP.NET MVC 2 Model Validation
Craig Stuntz's Weblog
– In this post, I will demonstrate how to make your own model validation attributes in order to share common validations throughout an ASP.NET MVC application, and which support MVC 2’s client-side validation feature. Validating a ZIP Code As an example, consider a model for an address. public ...
0
votes
Unit Testing Html Helpers for ASP.NET MVC
Craig Stuntz's Weblog
– Html helpers for ASP.NET MVC are static extension methods, which frequently reference the ViewContext and HttpContext. Combined, this can make unit testing a bit tricky. Let’s write a new Html helper using a test-first methodology. Let’s start with a prototype function: public ...
0
votes
How Does Html.EnableClientValidation() Inject JavaScript?
Craig Stuntz's Weblog
– For a project I’m currently working on, I have a need to add some JavaScript at the end of a page in an ASP.NET MVC application. Since this is part of what Html.EnableClientValidation does, I thought that I would check out that source code to see if there was any kind of generalized mechanism ...
August 2010
1
vote
Troubleshooting Entity Framework Connection Strings
Craig Stuntz's Weblog
– In an application which uses the Entity Framework, you may see the following error at runtime: MetadataException: Unable to load the specified metadata resource The cause of this error is a missing or malformed Entity Framework connection string. In particular, the cause of this error is the ...
1
vote
New InterBase Partner DVD In Progress
Craig Stuntz's Weblog
– The next version of InterBase is nearing completion, and, as always, will include a Partner DVD with demo versions of third-party tools supporting InterBase. If you are an InterBase Partner, you should have already been notified of how to submit your product. If you produce a tool or component ...
July 2010
0
votes
grid.history Demo Fixed
Craig Stuntz's Weblog
– Apologies to those who tried my grid.history demo page Friday. In the course of updating the integration to support jqGrid 3.7.2 and simultaneously learning GitHub’s pages feature, I killed the demo. It’s fixed now, and I’ve added the ability to run the unit tests directly from ...




