This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* *** | |
* This is a method from an object-relation-mapping (ORM) tool that I had started to write. | |
* I eventually stopped working on it, ad instead contributed time to the open source | |
* SubSonic project instead. | |
* | |
* This method is an example of generating DynamicMethods to be used at runtime to check and | |
* set some properties any an arbitrary type. This was used over straight reflection every time | |
* because reflection can be fairly slow. The use of a DynamicMethod is much quicker. | |
* *** */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* *** | |
* This sample is again from an ORM tool that I had been working on. | |
* | |
* This is simply an example of a "factory" pattern that I wrote a few years ago. | |
* This factory is designed to return the same IDataBinder instance when the same | |
* database connection string is passed in. | |
* *** */ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Web.Mvc; | |
namespace Web.Extensions | |
{ | |
public static class HtmlHelperDisplayNameExtensions | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Data.Entity; | |
using System.Linq; | |
using System.Linq.Expressions; | |
namespace Rally25rs.Gist.Data | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
/// <summary> | |
/// MSTest Asserts for unit testing MVC3 Controllers. | |
/// </summary> | |
public static class AssertMvc | |
{ | |
public static T ResultIs<T>(object result) | |
where T : ActionResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Specialized; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Moq; | |
/// <summary> | |
/// This helper class can be used to set up Moq mocks of MVC3 controllers. | |
/// Slightly modified from the original version from Scott Hanselman's blog: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
namespace AnythingToCsv | |
{ | |
public static class EnumerableExtensions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By default, Json.Encode will turn an ExpandoObject into an array of items, | |
// because internally an ExpandoObject extends IEnumerable<KeyValuePair<string, object>>. | |
// You can turn it into a non-list JSON string by first wrapping it in a DynamicJsonObject. | |
[TestMethod] | |
public void JsonEncodeAnExpandoObjectByWrappingItInADynamicJsonObject() | |
{ | |
dynamic expando = new ExpandoObject(); | |
expando.Value = 10; | |
expando.Product = "Apples"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .gitignore for .NET projects | |
# Standard VS.NET | |
obj | |
bin | |
*.csproj.user | |
*.suo | |
*.cache | |
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kendo.data.binders.class = kendo.data.Binder.extend({ | |
init: function (target, bindings, options) { | |
kendo.data.Binder.fn.init.call(this, target, bindings, options); | |
// get list of class names from our complex binding path object | |
this._lookups = []; | |
for (var key in this.bindings.class.path) { | |
this._lookups.push({ | |
key: key, | |
path: this.bindings.class.path[key] |
OlderNewer