Archives
-
Making ASP.NET MVC Actions be Transactional By Default
Given any action method (we’ll use Index), if there is no attribute it should execute in a Transaction:
-
Inserting Transactions into Telerik’s ASP.NET MVC Grid
[The List View]
-
An xVal Provider For NHibernate Validator
I wrote a post about a month ago about using xVal with NHibernate Validator 1.2 which solved a problem I was having upgrading the xVal ‘in-the-box’ provider to work with a newer version of NHibernate Validator. There was a caveat that my solution only worked for ValidatorMode.UseAttribute and I wouldn’t catch XML or Loquacious (or other?) validation. This seemed to work OK, but Fabio Maulo wrote a comment to that post saying NHV has metadata which should be the same no matter which validation mode was used.
-
Major Hack: Repository Tests With NHibernate And SQLite on a CI Server
I recently setup my first continuous integration build server using JetBrains’ TeamCity product, and it couldn’t have been much simpler. However I kept running into an issue with my test projects whenever I was using NHibernate or SQLite (very useful or regression tests against an in-memory database).
-
Required Validator For NHibernate Validators
I’ve recently switched from the Enterprise Library Validation Application Block to using NHibernate Validators. If you are not familiar with the NHibernate Validator project, they are part of the NHibernate Contrib project and offer Validation constraints, and validation runner, and tight integration with NHibernate (especially great if you use NHibernate to generate your DB).
-
Common Web.Config transformations with Visual Studio 2010
I’ve been playing with Visual Studio 2010 Beta a little and one of my favorite new features (and there are many) is the new web.config transformation feature.
-
MVCContrib FluentHTML Select Lists and NHibernate
When using ASP.NET MVC you will eventually want to do a select (drop down) or even a multiple select list, and your first though might be to use <%= Html.DropDownList %>. Unfortunately you will soon notice that ASP.NET MVC always looks for a match between the name of the dropdown and a property on the model, and if it finds a match, it OVERRIDES the selected value(s) of the select list. Now of course not being able to reliably set the selected value(s) is a major problem – if you Google this you will get a ton of results and most people solve the issue by just changing the name of the Html.DropDownList(“name”) to something that doesn’t match a model property.
-
Using xVal with NHibernate Validator 1.2
This will be a quick and dirty post about how to get xVal 1.0 (http://xval.codeplex.com/) to work with the new NHibernate Validator 1.2beta (http://nhforge.org/media/p/7.aspx).
-
Save Your Codeplex Repository Credentials
I recently setup my first project ever in CodePlex and naturally I am very excited about its tight integration with TFS since my group uses TFS internally for source control as well. Connecting to CodePlex through the Visual Studio Team Explorer is very easy, you just use one of the tfs0x.codeplex.com servers as your target, and then give them a variation of your username and password to connect.
-
Visual Studio 2008 with TFS Explorer broken with SP1
When working in on a fresh Visual Studio 2008 SP1 install I needed to use TFS (as always) so I installed the TFS Team Explorer client from the TFS disk and I kept getting the following error whenever trying to view/edit Work Items:
-
Base Class Object Equality for NHibernate Objects
In any project where you use an ORM you often have all of your domain classes inherit from a common base class. Among other things, your base class often contains your identity property. Mine has a protected IdT (this is the Id type) field called id, and a public getter called ID.
-
A UrlHelper Extension For Creating Absolute Action Paths in ASP.NET MVC
ASP.NET MVC comes with a UrlHelper class in the System.Web.Mvc.Controller.Url namespace, which you can access through the Url property of any controller. This provides some handy methods to get the url of an action or route, among other things. For example, Url.Action(“About”, “Home”) will return the string “/Home/About”, which is the relative url of the About action on the Home controller.
-
Simple auditing using an NHibernate IInterceptor (Part 4)
This is the fourth and final post of a multi-part post series on writing simple auditing functionality for an ASP.NET application using NHibernate. The requirement was that every object modification event in the system should be logged by username and date. Specifically I don’t need to know exactly which properties were changed (just that a user was updated by whom at what time), but if you do need to save the changed properties there are plenty of hooks to do that.
-
Simple auditing using an NHibernate IInterceptor (Part 3)
This is the third post of a multi-part post series on writing simple auditing functionality for an ASP.NET application using NHibernate. The requirement was that every object modification event in the system should be logged by username and date. Specifically I don’t need to know exactly which properties were changed (just that a user was updated by whom at what time), but if you do need to save the changed properties there are plenty of hooks to do that.
-
Using jQuery Ajax methods in ASP.NET MVC: $.get() and $.getJSON() vs. $.post()
I’m currently working on a project that uses ASP.NET MVC and jQuery to do some Ajax magic, and I ran into a minor (but maybe not obvious) issue when using $.post() against an MVC action that returns a JsonResult.
-
Simple Auditing Using an NHibernate IInterceptor (Part 2)
This is the second post of a multi-part post series on writing simple auditing functionality for an ASP.NET application using NHibernate. The requirement was that every object modification event in the system should be logged by username and date. Specifically I don’t need to know exactly which properties were changed (just that a user was updated by whom at what time), but if you do need to save the changed properties there are plenty of hooks to do that.
-
Simple Auditing using an NHibernate IInterceptor (part 1)
This is the beginning of a multi-part post series on writing simple auditing functionality for an ASP.NET application using NHibernate. The requirement was that every object modification event in the system should be logged by username and date. Specifically I don’t need to know exactly which properties were changed (just that a user was updated by whom at what time), but if you do need to save the changed properties there are plenty of hooks to do that.
-
ASP.NET MVC Transaction Attribute (using NHibernate)
This attribute will be applied to any action method within an MVC controller, or even to an entire MVC controller class. It will cause the entire action (or any action in the controller, depending on usage) to be executed inside of a transaction, properly committing the transaction on successful method completion. If any unhandled exception occurred, the transaction will be rolled back.
-
Enterprise Library Validation – Custom Validators
In this post I am going to create a custom email validator that will integrate with the Enterprise Library Validation Application Block.