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; | |
using BCS.Shared; | |
using BCS.Shared.Nationalities; | |
using NUnit.Framework; | |
using SharpTestsEx; | |
namespace BCS.Handlers.Tests | |
{ | |
[TestFixture] |
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
[TestFixture] | |
public class CastleTest | |
{ | |
[Test] | |
public void Test() | |
{ | |
var container = new WindsorContainer(); | |
container.AddFacility<FactorySupportFacility>(); | |
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
//original: | |
[Required] | |
public string SomeProperty | |
{ | |
get { return someProperty; } | |
set | |
{ | |
someProperty = value; | |
if (isInSomeMode) return; | |
//do some stuff |
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
//IDataErrorInfo as a Mixed in implementation. | |
[MixIn(typeof(DataErrorInfoImpl)] | |
public class Person | |
{ | |
[Required] | |
public string FirstName{get;set;} | |
public string LastName {get;set;} | |
} |
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 class NancyEngineProvider : INancyBootStrapper, INancyModuleCatalog | |
{ | |
private readonly ContainerBuilder containerBuilder; | |
private IContainer container; | |
private bool isInitialized; | |
public NancyEngineProvider() | |
{ | |
containerBuilder = new ContainerBuilder(); | |
} |
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
//bootstrapper: | |
public class DemoBootStrapper : INancyBootStrapper | |
{ | |
private readonly Lazy<IWindsorContainer> containerInitializator | |
= new Lazy<IWindsorContainer>(Initialize); | |
private static IWindsorContainer Initialize() | |
{ | |
var container = new WindsorContainer(); |
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.Collections.Generic; | |
using Castle.Facilities.TypedFactory; | |
using Castle.MicroKernel.Registration; | |
using Castle.MicroKernel.Resolvers.SpecializedResolvers; | |
using Castle.Windsor; | |
using Nancy.Routing; | |
namespace Nancy.Containers.Windsor | |
{ |
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 int UserId | |
{ | |
get { return User.Id;} | |
set { User = SomeDoNoWaht.Load<User>(value); } | |
} |
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 class Auditable : IPreUpdateEventListener, IPreInsertEventListener | |
{ | |
public bool OnPreUpdate(PreUpdateEvent @event) | |
{ | |
var auditable = @event.Entity as IAuditable; | |
if(auditable != null) | |
{ | |
auditable.UserId = //... | |
} | |
return true; |
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 override Shipment_Item Shipment_Item | |
{ | |
get | |
{ | |
return base.Shipment_Item; | |
} | |
set | |
{ | |
if (base.Shipment_Item == value) return; |