This file contains hidden or 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.Linq.Expressions; | |
| using System.Web; | |
| using System.Web.Mvc; | |
| public static class ControlGroupExtensions | |
| { | |
| public static IHtmlString BeginControlGroupFor<T>(this HtmlHelper<T> html, | |
| Expression<Func<T, object>> modelProperty) | |
| { |
This file contains hidden or 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
| namespace Helpers.Validators | |
| { | |
| using System.ComponentModel.DataAnnotations; | |
| public class DateFormatAttribute : RegularExpressionAttribute | |
| { | |
| public DateFormatAttribute() : base(@"^((0[1-9])|([1-2][0-9])|3[0-1])\/((0[1-9])|(1[0-2]))\/[0-9]{4}$") | |
| { | |
| } |
This file contains hidden or 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 Elmah; | |
| public class ElmahHandledErrorLoggerFilter : IExceptionFilter | |
| { | |
| public void OnException(ExceptionContext context) | |
| { | |
| // Log only handled exceptions, because all other will be caught by ELMAH anyway. |
This file contains hidden or 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.Text.RegularExpressions; | |
| [Flags] | |
| public enum PostcodeParseOptions | |
| { | |
| None = 0, | |
| IncodeOptional = 1, | |
| MatchBfpo = 2, | |
| MatchOverseasTerritories = 4, |
This file contains hidden or 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 MvcApplication() | |
| { | |
| BeginRequest += delegate { CurrentSessionContext.Bind(SessionFactory.OpenSession()); }; | |
| EndRequest += delegate | |
| { | |
| if (SessionFactory != null && CurrentSessionContext.HasBind(SessionFactory)) | |
| CurrentSessionContext.Unbind(SessionFactory).Dispose(); | |
| }; | |
| } |
This file contains hidden or 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.Web.Mvc; | |
| [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] | |
| public class TransactionAttribute : ActionFilterAttribute | |
| { | |
| public override void OnActionExecuting(ActionExecutingContext filterContext) | |
| { | |
| var session = MvcApplication.SessionFactory.GetCurrentSession(); | |
| session.BeginTransaction(); |
This file contains hidden or 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
| namespace Data | |
| { | |
| using System; | |
| using System.Configuration; | |
| using System.IO; | |
| using System.Reflection; | |
| using System.Runtime.Serialization.Formatters.Binary; | |
| using FluentNHibernate.Cfg; | |
| using FluentNHibernate.Cfg.Db; | |
| using FluentNHibernate.Conventions.Helpers; |
This file contains hidden or 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
| namespace Core.Repository | |
| { | |
| using Core.Model; | |
| using Core.Model.Some; | |
| public interface IRepositoryFactory | |
| { | |
| ISomeRepository SomeRepository(); | |
| IRepository<SomeObjectType> SomeObjectTypeRepository(); | |
| IRepository<T> Repository<T>() where T : class; |
This file contains hidden or 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
| namespace Core.Repository | |
| { | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| public interface IRepository<T> where T : class | |
| { | |
| bool Add(T entity); |
This file contains hidden or 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
| namespace Specifications | |
| { | |
| public interface ISpecification<T> | |
| { | |
| bool IsSatisfiedBy(T candidate); | |
| ISpecification<T> And(ISpecification<T> other); | |
| ISpecification<T> Or(ISpecification<T> other); | |
| ISpecification<T> Not(); | |
| } |