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
// JS Module Pattern: | |
// http://j.mp/module-pattern | |
// Redefine: $, window, document, undefined. | |
var APP = (function($, window, document, undefined) { | |
// Automatically calls all functions in APP.init | |
$(document).ready(function() { | |
APP.go(); | |
}); |
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
public class PocoInvoker : ControllerActionInvoker { | |
protected override ActionResult CreateActionResult (ControllerContext controllerContext, ActionDescriptor actionDescriptor, object actionReturnValue) { | |
if (!(actionReturnValue is ActionResult)) { | |
controllerContext.Controller.ViewData.Model = actionReturnValue; | |
return new PocoResult (actionReturnValue); | |
} | |
return base.CreateActionResult (controllerContext, actionDescriptor, actionReturnValue); | |
} | |
} |
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.Web; | |
using System.Web.Mvc; | |
using Facebook; | |
using MyFacebookSite3434.Models; | |
using System.Web.Security; | |
namespace MyFacebookSite3434.Controllers |
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
// See: http://stackoverflow.com/questions/3441916/automapper-mapping-issue-with-inheritance-and-abstract-base-class-on-collection/5749579#5749579 | |
// | |
// For use with AutoMapper | |
public class ProxyConverter<TSource, TDestination> : ITypeConverter<TSource, TDestination> | |
where TSource : class | |
where TDestination : class | |
{ | |
public TDestination Convert(ResolutionContext context) | |
{ | |
// Get dynamic proxy base type |
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; | |
namespace ActionProviders | |
{ | |
/// <summary> | |
/// The extended controller actions invoker, using other than controllers action providers. | |
/// </summary> | |
public class ActionInvoker : ControllerActionInvoker | |
{ | |
private readonly IActionProvider[] _actionProviders; |
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
/* | |
* jQuery.ajaxQueue - A queue for ajax requests | |
* | |
* (c) 2011 Corey Frang | |
* Dual licensed under the MIT and GPL licenses. | |
* | |
* Requires jQuery 1.5+ | |
*/ | |
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery) |
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
var order = session.Query<Order>() | |
.Customize(x => x.Include<Order>(o=>o.CustomerId)) // Load also the costumer | |
.First(); | |
var customer = session.Load<Customer>(order.CustomerId); |
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.Web; | |
using System.Web.Mvc; | |
namespace demo2 | |
{ | |
/// <summary> | |
/// From Scott Hanselman |
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
/// <summary> | |
/// Provides projection mapping from an IQueryable sourceto a target type. | |
/// | |
/// This allows from strongly-typed mapping and querying only necessary fields from the database. | |
/// It takes the place of Domain -> ViewModel mapping as it allows the ViewModel to stay as | |
/// IQueryable. AutoMapper works on in-memory objects and will pull all full records to perform | |
/// a collection mapping. Use AutoMapper for Input -> Domain scenarios, but not DAL. | |
/// | |
/// Reference: http://devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code | |
/// </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
Microsoft Visual Studio Solution File, Format Version 11.00 | |
# Visual Studio 2010 | |
Global | |
GlobalSection(SolutionProperties) = preSolution | |
HideSolutionNode = FALSE | |
EndGlobalSection | |
EndGlobal |
OlderNewer