Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
@kkozmic
kkozmic / gist:394428
Created May 8, 2010 07:35
Nested closure fluent API for Event Wiring Facility
[Test]
public void Can_specify_multiple_subscribers()
{
container.Register(
Component.For<SimplePublisher>()
.PublishEvent(p => p.Event += null,
x => x.To("foo")
.To<SimpleListener>("bar", l => l.OnPublish(null, null))),
Component.For<ListenerWithOnEventMethod>().Named("foo"),
Component.For<SimpleListener>().Named("bar"));
@kkozmic
kkozmic / gist:393894
Created May 7, 2010 19:20
Fluent API for current functionality of Windsor's EventWiringFacility
[Test]
public void Single_publisher_single_subscriber_single_event()
{
container.Register(
Component.For<SimplePublisher>()
.PublishEvent(p => p.Event += null)
.ToSubscribers(
EventSubscriber
.Named("foo")
.HandledBy<SimpleListener>(l => l.OnPublish(null, null))),
@kkozmic
kkozmic / gist:392401
Created May 6, 2010 17:09
Suggested fluent API for Windsor's EventWiringFacility
[Test]
public void Can_fluently_wire_events()
{
container.Register(Component.For<SimplePublisher>().PublishEvent("Event", "myUniqueEventId"),
Component.For<SimpleListener>().SubscribeEvent("myUniqueEventId", "OnEvent"));
var publisher = container.Resolve<SimplePublisher>();
var listener = container.Resolve<SimpleListener>();
Assert.IsFalse(listener.Listened);
if (ComponentType.IsGenericType)// we support generic collections only
{
// TypeUtil.GetAllInterfaces resturns flat collection of all interfaces, regardless of level
foreach (var @interface in TypeUtil.GetAllInterfaces(ComponentType))
{
if(@interface.GetGenericTypeDefinition()==typeof(IEnumerable<>))
{
return @interface.GetGenericArguments().Single();
}
}
// Copyright 2004-2010 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/src/Castle.Windsor/Installer/ConfigurationInstaller.cs b/src/Castle.Windsor/Installer/ConfigurationInstaller.cs
index 8ac2004..9e5356a 100644
--- a/src/Castle.Windsor/Installer/ConfigurationInstaller.cs
+++ b/src/Castle.Windsor/Installer/ConfigurationInstaller.cs
@@ -1,75 +1,75 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
public class ConcreteLoader : ILazyComponentLoader
{
public IRegistration Load(string key, Type service)
{
// to make sure it really is concrete type
if (!(service.IsClass&&service.IsAbstract==false))
{
return null;
}
[Test]
public void ResolveAllAccountsForAssignableServices()
{
kernel.AddComponent("test", typeof(ICommon), typeof(CommonImpl2));
kernel.AddComponent("test2", typeof(ICommonSub1), typeof(CommonSub1Impl));
kernel.AddComponent("test3", typeof(ICommonSub1), typeof(CommonSub1Impl));
ICommon[] services = kernel.ResolveAll<ICommon>();
Assert.AreEqual(3, services.Length);
}
Castle.DynamicProxy.IAttributeDisassembler |0 |
Castle.Core.Interceptor.IChangeProxyTarget |1 |
Castle.Core.Interceptor.IInterceptor |1 |
Castle.Core.Interceptor.IInterceptorSelector |1 |
Castle.Core.Interceptor.IInvocation |1 |
Castle.Core.Interceptor.IProxyTargetAccessor |1 |
Castle.Core.Interceptor.StandardInterceptor |1 |
Castle.Core.Internal.ILockHolder |1 |
Castle.Core.Internal.IUpgradeableLockHolder |1 |
Castle.Core.Internal.Lock |1 |
SELECT benchmarkr0_.User as User2_,
benchmarkr0_.Id as Id2_,
benchmarkr0_.Id as Id0_1_,
benchmarkr0_.BenmchmarkName as Benmchma2_0_1_,
benchmarkr0_.ComputerModel as Computer3_0_1_,
benchmarkr0_.Score as Score0_1_,
benchmarkr0_.[User] as User5_0_1_,
user1_.Id as Id1_0_,
user1_.Name as Name1_0_,
user1_.Email as Email1_0_,