ASP.Net MVC avoiding magic strings at all costs
Like most developers we all like to avoid magic strings wherever possible. One place that we found to be littered with these magic strings is our controllers and to a lesser but still notable extent...
View ArticleNHibernate POCO classes expose read-only collection
The C# standard for exposing a read-only collection is to use the ReadOnlyCollection<T> type from the System.Collections.ObjectModel namespace but NHibernate doesn't play with this type at all....
View ArticleUsing CSS to insert dividers into primary navigation
We wanted to have a primary navigation with a > seperator but didn't want the work of creating a (non-scaling) background image for the items. So we took our clean HTML<!DOCTYPE...
View ArticleEPiServer CMS 7 MVC Basic custom page type pattern
To create a custom page type for EPiServer CMS v7 using MVC we needed to create four files; the page type itself (marked with the EPiServer.DataAnnotations.ContentType attribute and inheriting...
View ArticleEPiServer CMS 7 MVC Get child pages of specific type
Since we have all our views built on view models (and not our business entities) we often need to pass collections of child view models into the parent view model. In EPiServer CMS everything is a page...
View ArticleEPiServer CMS 7 MVC Notes
Create a new page in codeTo create a new page as a child of a specific pagenamespace Website.Plugins { using EPiServer; using EPiServer.Core; public class DataImportJob { public static OperationResult...
View ArticleLocking records for Save, Update and, Delete operations with your entity manager
So we need to be able to know that an entity is locked before we Save, Update or, Delete it and we need to know that this lock is exclusive. We have a System.Tuple keyed with a Guid that represents the...
View ArticleNHibernate POCO classes - modify collection property
If you read our article NHibernate POCO classes expose read-only collection you will know that all our domain types expose only read-only collection properties by returning IEnumerable<T> as the...
View ArticleExtend NHibernate to support DateTime.AddDays()
Over the weekend we tried to include the DateTime.AddDays() function in an Expression<Func<T, bool>> passed to NHibernate.Linq. This threw a NotSupportedException. So we had to implement...
View ArticleASP.net MVC tips, tricks and, hidden gems
Lowercase generated URLsIn Global.asaxpublic static void RegisterRoutes(RouteCollection routes) { ... routes.LowercaseUrls = true; ... }This makes all generated URLs lowercase (rather than the default...
View Article
More Pages to Explore .....