diff --git a/ComputingServices/Taskhost.d/Invoke/JSON/Argument.vb b/ComputingServices/Taskhost.d/Invoke/JSON/Argument.vb index 51430fd..dc2fd2d 100644 --- a/ComputingServices/Taskhost.d/Invoke/JSON/Argument.vb +++ b/ComputingServices/Taskhost.d/Invoke/JSON/Argument.vb @@ -31,8 +31,8 @@ Namespace TaskHost ''' Creates the function remote calls one of its parameter value. ''' ''' - Sub New(o As Object) - Dim type As Type = o.GetType + Sub New(o As Object, Optional type As Type = Nothing) + type = If(type, o.GetType) Me.type = type.FullName Me.value = JsonContract.GetObjectJson(o, type) diff --git a/ComputingServices/Taskhost.d/Invoke/JSON/Return.vb b/ComputingServices/Taskhost.d/Invoke/JSON/Return.vb index 3b2cb2f..d2b1db0 100644 --- a/ComputingServices/Taskhost.d/Invoke/JSON/Return.vb +++ b/ComputingServices/Taskhost.d/Invoke/JSON/Return.vb @@ -52,7 +52,10 @@ Namespace TaskHost ''' ''' The returns value.(远端调用的函数返回) ''' - Public Class Rtvl(Of T) + ''' + ''' 因为在远端是一个通用的计算结果,所以没有办法使用泛型 + ''' + Public Class Rtvl ''' ''' 200 OK @@ -71,7 +74,7 @@ Namespace TaskHost ''' The result value in json string format ''' ''' - Public Property info As T + Public Property info As Argument Sub New() End Sub @@ -83,24 +86,20 @@ Namespace TaskHost Sub New(value As Object, type As Type) errCode = HTTP_RFC.RFC_OK - info = JsonContract.GetObjectJson(value, type) + info = New Argument(value, type) End Sub ''' - ''' If the remote execute raising a exception, then a exception will be throw from this function. + ''' If the remote execute raising a exception, + ''' then a exception will be throw from this function. ''' - ''' ''' - Public Function GetValue(type As Type) As Object + Public Function GetValue() As Object If errCode <> HTTP_RFC.RFC_OK Then - Throw New Exception(ex) + Throw message.Exception + Else + Return info.GetValue() End If - Return LoadObject(value, type) - End Function - - Public Function GetValue(func As [Delegate]) As Object - Dim type As Type = func.Method.ReturnType - Return GetValue(type) End Function Public Shared Function CreateObject(Of T)(x As T) As Rtvl