Skip to content

Instantly share code, notes, and snippets.

View kkozmic's full-sized avatar
🎯
Focusing

Krzysztof Kozmic kkozmic

🎯
Focusing
View GitHub Profile
public abstract class WcfLifestyle<TExtensibleObject, TCache> : AbstractLifestyleManager, IWcfLifestyle
where TExtensibleObject : class, IExtensibleObject<TExtensibleObject>
where TCache : class, IWcfLifestyleCache<TExtensibleObject>, new()
namespace ConsoleApplication2
{
using System.Diagnostics;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
class Program
{
static void Main(string[] args)
[Test]
public void Member_should_action()
{
Action action = () => { };
kernel.Register(
Component.For<HasDependencies>()
.Parameters(
Parameter.ForKey("date").Eq(new DateTime(2009, 12, 12)),
Parameter.ForKey("Action").Eq(action),
Parameter.ForKey("Uri").Eq(new Uri("http://castleproject.org")),
[Test]
public void Can_dynamically_override_service_overrides()
{
kernel.Register(
Component.For<ICustomer>()
.ImplementedBy<CustomerImpl>()
.Named("defaultCustomer"),
Component.For<ICustomer>().ImplementedBy<CustomerImpl2>()
.Named("otherCustomer")
.Parameters(
// instead of this
Component.For<ITwo>().ImplementedBy<Two>().LifeStyle.PerWcfSession().Interceptors(
InterceptorReference.ForType<CollectingInterceptor>()).Anywhere
// do this
Component.For<ITwo>().ImplementedBy<Two>().LifeStyle.PerWcfSession().InterceptedBy<CollectingInterceptor>()
using System;
using System.Linq;
namespace DP_perf_1
{
using System.Data;
using System.Diagnostics;
using System.ServiceModel;
using System.Web;
using System.Windows;
public class MyObject:INotifyPropertyChanged
{
public ICommand UpdateCommand { get; set; }
private string inputText;
public string InputText
{
get { return inputText; }
<Window x:Class="TypeWrapping.WpfSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<StackPanel Width="200" Name="Foo">
<TextBox Text="{Binding InputText, Mode=TwoWay}"></TextBox>
<Button Command="{Binding UpdateCommand}" Margin="0,3,0,3">Click Here</Button>
<TextBlock Text="{Binding OutputText}"></TextBlock>
</StackPanel>
public class MyObject:INotifyPropertyChanged
{
public ICommand Comand { get; set; }
private string inputText;
public string InputText
{
get { return inputText; }
public class TestClient
{
// no need for additional methods, properties, or delegates
// All internal state needs to be declared as protected proterties
protected virtual Address Address { get; set; }
// Domain behavior does not have to be virtual, nor return anything
public void ClientMoves(Address address)
{