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.Reflection; | |
using FluentNHibernate.AutoMap; | |
using FluentNHibernate.Framework; | |
using MyApplication.Core.Domain; | |
namespace MyApplication.Core.Persistence | |
{ | |
public class MyCustomPersistenceModel : AutoPersistenceModel | |
{ | |
public MyCustomPersistenceModel() |
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.Reflection; | |
using FluentNHibernate.AutoMap; | |
using FluentNHibernate.Framework; | |
using MyApplication.Core.Domain; | |
namespace MyApplication.Core.Persistence | |
{ | |
public class MyCustomPersistenceModel : AutoPersistenceModel | |
{ | |
public MyCustomPersistenceModel() |
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.Reflection; | |
using FluentNHibernate.AutoMap; | |
using FluentNHibernate.Framework; | |
using MyApplication.Core.Domain; | |
namespace MyApplication.Core.Persistence | |
{ | |
public class MyApplicationPersistenceModel : AutoPersistenceModel | |
{ |
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
namespace MyApplication.UnitTests.Core.Persistence | |
{ | |
[Category("MyApplicationPersistenceModel")] | |
public class when_using_the_plan_my_night_persistence_model | |
: Specification, with_auto_persistence_model | |
{ | |
private MyApplicationPersistenceModel _model; | |
public override void establish_context() | |
{ |
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 FindGoodStuffQuery : INamedQuery<Idea> | |
{ | |
public IQueryable<Stuff> Apply(IQueryable<Stuff> queryable) | |
{ | |
return queryable | |
.OrderByDescending(s => s.Widgets.Count()) | |
.ThenByDescending(s => s.CreatedAt); | |
} | |
} |
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 FindGoodStuffQuery : INamedQuery<Idea> | |
{ | |
public IQueryable<Stuff> Apply(IQueryable<Stuff> queryable) | |
{ | |
return queryable | |
.OrderByDescending(s => s.Widgets.Count()) | |
.ThenByDescending(s => s.CreatedAt); | |
} | |
} |
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 when_requesting_a_custom_logo_and_none_is_configured : concerns<CustomizationController> | |
{ | |
private readonly Type NotFoundException = typeof (HttpException); | |
private CustomizationController _controller; | |
protected override void Context() | |
{ | |
Dependency<IConfigureTheApplication>().Stub(i => i.Logo).Return(null); | |
_controller = BuildUp(); | |
} |
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
// started here | |
public class Entry : Entity | |
{ | |
private DateTime _createdAt; | |
public bool IsWithinEditWindow() | |
{ | |
return _createdAt.IsAfter(20.Minutes().Ago()); | |
} | |
} |
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> | |
/// Bypasses IIS7 custom Errors. | |
/// </summary> | |
public class TrySkipIisCustomErrors : FilterAttribute, IActionFilter | |
{ | |
public void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
filterContext.HttpContext.Response.TrySkipIisCustomErrors = true; | |
} |
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
// extremely lame example, but I like the functional aspect of it. | |
// also, combining the bool/func pairs into objects (strategies) might | |
// be a nice way to cordon off the coupling. Oh, and the naming could | |
// much improved, which would help greatly with readability. | |
var use_public_forums = | |
new Dictionary<bool, Func<IEnumerable<Forum>, IEnumerable<Forum>>> | |
{ | |
{true, forums => forums.Where(forum => !forum.IsPrivate)}, | |
{false, forums => forums} |
OlderNewer