Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
/// <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>
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;
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>();
}
var container = new WindsorContainer();
container.AddFacility<NHibernateFacility>(c => c.ForMsSql2005().ConnectionStringName("myConnectionString"))));
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.
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
);
}
public class Foo
{
public Foo() {} //1
public Foo(string foo = null) {} //2
}
public class Bar
{
public Bar() {} //3
[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 interface IServiceHostBuilder
{
ServiceHostModel Build();
}
public abstract class ServiceModelBuilder<TService> :IServiceHostBuilder
{
// goo
}
D:\dev\ir\bin>nu install dotless
unknown:0: warning: already initialized constant OPT_TABLE
unknown:0: warning: already initialized constant S_IF_DOOR
unknown:0: warning: already initialized constant METHODS
D:/dev/ir/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:157:in `parse': Illformed requirement [nil] (ArgumentError)
from D:/dev/ir/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:73:in `initialize'
from IronRuby.Libraries:0:in `<Map>b__3'
from IronRuby.Libraries:0:in `each'
from IronRuby.Libraries:0:in `Each'
from D:/dev/ir/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:72:in `map'