August 28, 2014

Mocking a generic ObjectSet or IObjectSet for Unit Testing Entity Framework Business Logic

By |2014-08-28T21:35:42+00:00August 28th, 2014|Categories: C#, Testing|Tags: |

Up until this point, I had mostly been using nHibernate for my ORM solution in most applications I work on. So when I started diving into Entity Framework (EF) models and trying to write unit tests against logic that lives in EF entities, I first encountered the ObjectSet<T> type. Now to be clear, I was not [...]

April 24, 2014

MVC Model Binding with an Ajax Form Submit

By |2014-04-24T16:19:52+00:00April 24th, 2014|Categories: C#, MVC|Tags: , , , , |

You may come across a time where you would like to submit a form using Ajax, and still want to preserve the useful model binding of MVC. Normally when you submit a form using a standard submit (non async), the MVC framework will automatically take care of pulling your values out of your form and populating [...]

January 24, 2014

C# String extension method to escape characters for regular expressions (regex)

By |2014-01-24T07:43:31+00:00January 24th, 2014|Categories: C#, Handy Tools/Utilities|

I needed a way to escape special regex characters in a string. These characters include the following: ".", "$", "^", "{", "[", "(", "|", ")", "*", "+", "?", "\\" . This list was obtained from http://msdn.microsoft.com/en-us/library/4edbef7e(v=vs.110).aspx Here is a small string extension method that will accomplish this: Edit*- 1/24/13 - I didn't realize there was a built in [...]

Go to Top