Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
public interface IServiceHostBuilder
{
ServiceHostModel Build();
}
public abstract class ServiceModelBuilder<TService> :IServiceHostBuilder
{
// goo
}
[Test]
public void Dictionary_enumerates_from_oldest_to_latest()
{
var expected1 = new[] { 1, 2, 4, 3 };
var dictionary1 = new Dictionary<int, object>();
foreach (var key in expected1)
{
dictionary1[key] = new object();
}
public class Foo
{
public Foo() {} //1
public Foo(string foo = null) {} //2
}
public class Bar
{
public Bar() {} //3
public class DataAccessInstaller:IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Kernel.ComponentModelBuilder.AddContributor(new SubmitChangesDataContextContributor());
container.Register(Component.For<DataDataContext>()
.LifeStyle.PerWebRequest
// some other components
);
}
Starting Test Run: 4/07/2010 8:44:43 AM
A Silverlight MessageBox dialog was automatically closed.
Caption: Unhandled Error in Silverlight Application
Super Secret StatLight Code: 836D4425-DB59-48BB-BA7B-03AB20A57499
Code: 4004
Category: ManagedRuntimeError
Message: System.IO.FileNotFoundException: Could not load file or assembly 'NUnit.Silverlight.Compatibility, Version=2010.6.1.
0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.
var container = new WindsorContainer();
container.AddFacility<NHibernateFacility>(c => c.ForMsSql2005().ConnectionStringName("myConnectionString"))));
public interface IReference<out T> {}
public class ComponentReference<T> : IReference<T> {}
// somewhere
public static IReference<IInterceptor> ForType<T>() where T:IInterceptor
{
// this won't compile
return new ComponentReference<T>();
}
namespace Castle.Windsor.Tests
{
using System;
using System.Collections.Generic;
using Castle.Core;
using Castle.MicroKernel;
using Castle.MicroKernel.ComponentActivator;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.Resolvers;
using Castle.MicroKernel.Tests.ClassComponents;
/// <summary>
/// Helper class used by <see cref="FromAssembly"/> to filter/order and instantiate <see cref="IWindsorInstaller"/> implementations
/// </summary>
public class InstallerFactory
{
/// <summary>
/// Performs custom filtering/ordering of given set of types.
/// </summary>
/// <param name="installerTypes">Set of concrete class types implementing <see cref="IWindsorInstaller"/> interface.</param>
/// <returns>Transformed <paramref name="installerTypes"/>.</returns>
@kkozmic
kkozmic / gist:394429
Created May 8, 2010 07:38
same test, but with static-entry point this time
[Test]
public void Can_specify_multiple_subscribers()
{
container.Register(
Component.For<SimplePublisher>()
.PublishEvent(p => p.Event += null)
.ToSubscribers(
EventSubscriber.Named("foo"),
EventSubscriber
.Named("bar")