Пример #1
0
 protected void InitializeInternal(INativeCall call)
 {
     lock (myLock)
     {
         this.call = call;
     }
 }
Пример #2
0
        static NativeCall() {

            // The static constructor is responsible for generating the
            // assembly and the methods that implement the IJW thunks.
            //
            // To do this, we actually use reflection on the INativeCall
            // interface (defined below) and generate the required thunk 
            // code based on the method signatures.

            AssemblyName aname = new AssemblyName();
            aname.Name = "e__NativeCall_Assembly";
            AssemblyBuilderAccess aa = AssemblyBuilderAccess.Run;

            aBuilder = Thread.GetDomain().DefineDynamicAssembly(aname, aa);
            mBuilder = aBuilder.DefineDynamicModule("e__NativeCall_Module");

            TypeAttributes ta = TypeAttributes.Public;
            TypeBuilder tBuilder = mBuilder.DefineType("e__NativeCall", ta);

            Type iType = typeof(INativeCall);
            tBuilder.AddInterfaceImplementation(iType);

            // Use reflection to loop over the INativeCall interface methods, 
            // calling GenerateThunk to create a managed thunk for each one.

            foreach (MethodInfo method in iType.GetMethods()) {
                GenerateThunk(tBuilder, method);
            }
            
            Type theType = tBuilder.CreateType();

            Impl = (INativeCall)Activator.CreateInstance(theType);

        }
Пример #3
0
 /// <summary>
 /// This constructor should only be used for testing.
 /// </summary>
 public AsyncCall(CallInvocationDetails <TRequest, TResponse> callDetails, INativeCall injectedNativeCall) : this(callDetails)
 {
     this.injectedNativeCall = injectedNativeCall;
 }
Пример #4
0
 /// <summary>
 /// Only for testing purposes.
 /// </summary>
 public void InitializeForTesting(INativeCall call)
 {
     server.AddCallReference(this);
     InitializeInternal(call);
 }
Пример #5
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="nativeCall">OS依存機能</param>
 public BizLogic(INativeCall nativeCall)
 {
     this.nativeCall = nativeCall;
 }