Skip to content

Instantly share code, notes, and snippets.

View jfromaniello's full-sized avatar
😀
coding

José F. Romaniello jfromaniello

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