コード例 #1
0
 protected override void Map(ICompositeBuilder <IPropertyInterface, IPropertyState> builder)
 {
     builder.MapMethod(typeof(IPropertyInterface).GetProperty("Text").GetGetMethod(), GetType().GetMethod("GetTextImpl"));
     builder.MapMethod(typeof(IPropertyInterface).GetProperty("Text").GetSetMethod(), GetType().GetMethod("SetTextImpl"));
     builder.MapMethod(typeof(IPropertyInterface).GetProperty("SetOnly").GetSetMethod(), GetType().GetMethod("SetOnlyImpl"));
     builder.MapMethod(typeof(IPropertyInterface).GetProperty("GetOnly").GetGetMethod(), GetType().GetMethod("GetOnlyImpl"));
 }
コード例 #2
0
        protected override void Map(ICompositeBuilder <ISimpleInterface, INoState> builder)
        {
            builder.MapMethod(typeof(ISimpleInterface).GetMethod("Foo"), GetType().GetMethod("FooImpl"));

            if (!_incomplete)
            {
                builder.MapMethod(typeof(ISimpleInterface).GetMethod("Bar"), GetType().GetMethod("BarImpl"));
                builder.MapMethod(typeof(ISimpleInterface).GetMethod("Baz"), GetType().GetMethod("BazImpl"));
            }
        }
コード例 #3
0
 protected override void Map(ICompositeBuilder <IMappingExtensionsSample, INoState> builder)
 {
     builder.MapMethods()
     .For(x => x.Action0).Use(Action0Impl)
     .For <string>(x => x.Action1).Use(Action1Impl)
     .For <int, string>(x => x.Action2).Use(Action2Impl)
     .For <int>(x => x.Method0).Use(ctx => 2)
     .For <int, string>(x => x.Method1).Use(Method1Impl)
     .For <int, double, string>(x => x.Method2).Use(Method2Impl);
 }
コード例 #4
0
        protected override void Map(ICompositeBuilder <IPropertyExtensionsSample, IPropertyExtensionsState> builder)
        {
            builder.MapProperties()
            .For(x => x.Text).UseStateProperty(s => s.TextState)

            .ForGetter(x => x.GetOnly).UseStateProperty(s => s.Value)
            .ForSetter <int>((x, v) => x.SetOnly = v).UseStateProperty(s => s.Value)

            .ForGetter(x => x.OtherText).Use(GetOtherTextImpl)
            .ForSetter <string>((x, v) => x.OtherText = v).Use(SetOtherTextImpl)

            .ForGetter(x => x.AnotherText).Use(ctx => ctx.State.AnotherTextState)
            .ForSetter <string>((x, v) => x.AnotherText = v).Use((ctx, value) => ctx.State.AnotherTextState = value);
        }
コード例 #5
0
ファイル: MappingExtensions.cs プロジェクト: orb1t/NComposite
 public static IMethodMapper <TInterface, IContext <TInterface, TState> > MapMethods <TInterface, TState>(
     this ICompositeBuilder <TInterface, TState> builder)
 {
     return(new MethodMapper <TInterface, IContext <TInterface, TState> >(builder));
 }
コード例 #6
0
ファイル: MappingExtensions.cs プロジェクト: orb1t/NComposite
 public static IPropertyMapper <TInterface, TState> MapProperties <TInterface, TState>(
     this ICompositeBuilder <TInterface, TState> builder)
 {
     return(new PropertyMapper <TInterface, TState>(builder));
 }
コード例 #7
0
 protected abstract void Map(ICompositeBuilder <TInterface, TState> builder);
コード例 #8
0
 protected override void Map(ICompositeBuilder <IStatefulInterface, IState> builder)
 {
     builder.MapMethod(typeof(IStatefulInterface).GetMethod("SetText"), GetType().GetMethod("SetTextImpl"));
     builder.MapMethod(typeof(IStatefulInterface).GetMethod("GetText"), GetType().GetMethod("GetTextImpl"));
 }
コード例 #9
0
 public MethodMapper(ICompositeBuilder compositeBuilder)
 {
     _compositeBuilder = compositeBuilder;
 }
コード例 #10
0
 public PropertyMapper(ICompositeBuilder <TInterface, TState> builder)
 {
     _builder = builder;
 }