Skip to content

Instantly share code, notes, and snippets.

public interface ICriterion
{
}
public interface IQuery
{
}
public class ConventionsTests
{
private const string PropertyName = "Name";
private readonly ModelMetadataRegistry registry;
private readonly Type modelType;
public ConventionsTests()
{
registry = new ModelMetadataRegistry();
modelType = typeof(DummyMetaconvTestModel);
using System;
using System.Collections;
using System.Linq.Expressions;
using System.Reflection;
using System.Web.Mvc;
/// <summary>
/// RegisterModelMetadata
/// </summary>
public class RegisterModelMetadata : BootstrapperTask
#region Copyright
// Copyright (c) 2009 - 2011, Kazi Manzur Rashid <kazimanzurrashid@gmail.com>, hazzik <hazzik@gmail.com>.
// This source is subject to the Microsoft Public License.
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
// All other rights reserved.
#endregion
namespace MvcExtensions
{
using System;
@AlexBar
AlexBar / BoolRequired.cs
Created April 15, 2012 11:38
Custom model validator for MvcExtensios
public class BoolRequired : CustomModelValidator
{
private readonly Func<string> _getErrorMsg;
public BoolRequired(ModelMetadata metadata, ControllerContext controllerContext, Func<string> getErrorMsg)
: base(metadata, controllerContext)
{
_getErrorMsg = getErrorMsg;
}
@AlexBar
AlexBar / Program.cs
Created November 15, 2011 18:29
Linq AutoProjection
class Program
{
static void Main()
{
List<Input> session = new List<Input>();
session.Add(new Input()
{
Id = 1,
Custom = "custom111",
Simple = "simple111"
@AlexBar
AlexBar / gist:1359021
Created November 11, 2011 19:45
delegate validator
internal class DelegateModelValidator<TModel> : ModelValidator
{
public DelegateModelValidator(ModelMetadata metadata, ControllerContext controllerContext)
: base(metadata, controllerContext)
{
}
public Func<TModel, bool> CheckValidity { get; set; }
public Func<string> ErrorMessage { get; set; }
@AlexBar
AlexBar / CustomValidation.cs
Created November 11, 2011 16:25
CustomValidator MvcExtensions
using System;
using System.Collections.Generic;
using System.Web.Mvc;
namespace MvcExtensions
{
public class CustomValidationMetadata<TValidator> : ModelValidationMetadata where TValidator : CustomValidator, new()
{