Category Archives: c#

MVC RC1

As I’m sure you noticed, MVC RC1 is out now. In reading through the release notes I found this: “The overloads for DropDownList and ListBox helper methods were reworked to fix various usability problems that were reported by customers.” Thanks … Continue reading

Posted in ASP.Net, c# | Leave a comment

GAC Conflicts with ASP MVC

By some strange combination of beta and pre-release candidate installs I managed to create some serious conflicts with ASP.NET MVC. Thereby producing this wonderful little error: Compiler Error Message: CS0433: The type ‘System.Web.Mvc.FormMethod’ exists in both ‘c:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll’ and ‘c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET … Continue reading

Posted in ASP.Net, c# | 1 Comment

Sql Server DateTime Conversion

Suppose that your model requires selecting over a date range. It is frequently more convenient to store DateTime.MinValue than it is to store a NULL as this allows for easy selecting without doing a bunch of field < value or … Continue reading

Posted in c#, NHibernate | 1 Comment

ModelStateDictionary and ParameterBinding

I laid this out in more detail on the forums here: http://forums.asp.net/p/1317154/2610342.aspx#2610342 I thought I’d mention it to this group so that people were aware of this difference between the interaction the old ParameterBinders and Rescues in version 4 and … Continue reading

Posted in ASP.Net, c# | Leave a comment

ISession Extension for Saving Multiple Objects

Incredibly simple, but quite useful:         public static void Save(this ISession session, params object [] entities)         {             foreach (var o in entities)             {                 session.Save(o);             … Continue reading

Posted in c#, NHibernate | Leave a comment

CriteriaByLongAlias

This simple function cleans up a lot of the Alias sillyness I have fought with in NHibernate.         public static ICriteria CriteriaByLongAlias(this ICriteria criteria, string field)         {             ICriteria byAlias = criteria.GetCriteriaByAlias(criteria.Alias + “_” + … Continue reading

Posted in c#, NHibernate | Leave a comment

Cool Code – Assembly.FindType

Here’s an extension to Assembly that I found useful for finding a type. I recommend doing typeof(TypeInAssembly).Assembly.FindType(“typename”);     public static class AssemblyExtensions     {         public static Type FindType(this Assembly assembly, string typename)         {             … Continue reading

Posted in c# | Leave a comment

Contributing to NHibernate

Having successfully submitted a few patches to NHibernate [NH-1280][NH-1260][NH-1259], Ayende Rahien asked me to comment on the difficulty of adding a totally new feature, and provide some hints for others. I am by no means an expert on NHibernate, just … Continue reading

Posted in c#, Tutorials | 6 Comments

MVC UnitTestingFramework to MvcContrib

The Unit Testing Framework I posted a couple of days ago has now been moved into the MvcContrib project, making me an official Developer. Woo Hoo. You can check out the updated documentation.

Posted in Blog, c# | Leave a comment

IParseable Interface

[Note: I was reminded by my roommate after posting this that static methods aren't allowed in interfaces....] Today I was working on a JSON to NHibernate bridge when I came across something quite frustrating when trying to convert strings to … Continue reading

Posted in c# | Leave a comment