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 Moq; | |
using NUnit.Framework; | |
using Sitecore.ContentSearch; | |
using Sitecore.ContentSearch.Linq; | |
using Sitecore.ContentSearch.SearchTypes; |
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> | |
/// Disables the cache for Glass Mapper. This is used for the content management server | |
/// as we don't want to use it here. | |
/// </summary> | |
public class DisableGlassMapperCache | |
{ | |
/// <summary> | |
/// Processes the specified arguments. | |
/// </summary> | |
/// <param name="args">The arguments.</param> |
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 abstract class RenderingModelBase : RenderingModel | |
{ | |
protected T GetGlassItem<T>() | |
{ | |
return RenderingContext.CurrentOrNull.Rendering.Item.GlassCast<T>(); | |
} | |
} |
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 ValidateFormHandler : ActionMethodSelectorAttribute | |
{ | |
/// <summary> | |
/// Determines whether the current action is valid for this request. | |
/// </summary> | |
/// <param name="controllerContext">The controller context.</param> | |
/// <param name="methodInfo">The method information.</param> | |
/// <returns>Boolean value if request is valid</returns> | |
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) | |
{ |
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 UnicHelper : Sitecore.Mvc.Helpers.SitecoreHelper | |
{ | |
/// <summary> | |
/// The controller field name | |
/// </summary> | |
public const string ControllerFieldName = "fhController"; | |
/// <summary> | |
/// The action field name | |
/// </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
// good design | |
var numbers = new int[] {1, 2, 3, 4}; | |
var stringBuilder = new StringBuilder(); | |
var letters = new List(); | |
var keywords = new Dictionary(); | |
// OK (but prefer explicit declaration) | |
var pages = 10; // int, long, what to expect? | |
var username = "Kevin"; | |
var order = GetOrder(orderId); // ok if the type is Order, otherwise not |