From 43b35914fbc81c26a3242685b2a1be30ce747337 Mon Sep 17 00:00:00 2001 From: bbaia Date: Fri, 3 Jun 2011 23:38:40 +0000 Subject: [PATCH] WebServiceExporter invokes service constructor twice when configured as non singleton [SPRNET-1448] --- .../Web/Services/WebServiceExporter.cs | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs b/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs index b3b90ca1..c4a867fd 100644 --- a/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs +++ b/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs @@ -505,30 +505,20 @@ namespace Spring.Web.Services protected override void ImplementConstructors(TypeBuilder builder) { MethodAttributes attributes = MethodAttributes.Public | - MethodAttributes.HideBySig | MethodAttributes.SpecialName | - MethodAttributes.RTSpecialName; + MethodAttributes.HideBySig | MethodAttributes.SpecialName | + MethodAttributes.RTSpecialName; ConstructorBuilder cb = builder.DefineConstructor( attributes, CallingConventions.Standard, Type.EmptyTypes); ILGenerator il = cb.GetILGenerator(); - il.Emit(OpCodes.Ret); - } - /// - /// Generates the IL instructions that pushes - /// the target instance on which calls should be delegated to. - /// - /// - /// This will cause the builder to generate - /// WebServiceExporter.GetTarget( EXPORTER_ID ).<targetmethod>(..) - /// for each exported method. - /// - /// The IL generator to use. - public override void PushTarget( ILGenerator il ) - { - il.Emit( OpCodes.Ldstr, this.exporter.EXPORTER_ID ); + il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldstr, this.exporter.EXPORTER_ID); il.Emit( OpCodes.Call, WebServiceExporter_GetTargetInstance ); + il.Emit(OpCodes.Stfld, targetInstance); + + il.Emit(OpCodes.Ret); } protected override IList GetTypeAttributes(Type type)