diff --git a/src/YaNco.Abstractions/IConnection.cs b/src/YaNco.Abstractions/IConnection.cs index 632611a..085eae8 100644 --- a/src/YaNco.Abstractions/IConnection.cs +++ b/src/YaNco.Abstractions/IConnection.cs @@ -120,4 +120,13 @@ public interface IConnection : IDisposable IRfcRuntime RfcRuntime { get; } IHasEnvRuntimeSettings ConnectionRuntime { get; } + + /// + /// Direct access to the connection handle. + /// + /// + /// Use this property only if you would like to call runtime api methods that are not covered by the interface. + /// When operating on the handle, you have to make sure that the connection is accessed in a thread safe manner. + /// + IConnectionHandle Handle { get; } } \ No newline at end of file diff --git a/src/YaNco.Abstractions/IDataContainer.cs b/src/YaNco.Abstractions/IDataContainer.cs index 13ed352..1f36e37 100644 --- a/src/YaNco.Abstractions/IDataContainer.cs +++ b/src/YaNco.Abstractions/IDataContainer.cs @@ -14,4 +14,12 @@ public interface IDataContainer : IDisposable Either GetStructure(string name); Either GetTable(string name); Either GetTypeDescription(); + + /// + /// Direct access to the container handle. + /// + /// + /// Use this property only if you would like to call runtime api methods that are not covered by the interface. + /// + IDataContainerHandle Handle { get; } } \ No newline at end of file diff --git a/src/YaNco.Abstractions/IFunction.cs b/src/YaNco.Abstractions/IFunction.cs index f6a5a7c..f4bca42 100644 --- a/src/YaNco.Abstractions/IFunction.cs +++ b/src/YaNco.Abstractions/IFunction.cs @@ -4,6 +4,12 @@ namespace Dbosoft.YaNco; public interface IFunction : IDataContainer { + /// + /// Direct access to the function handle. + /// + /// + /// Use this property only if you would like to call runtime api methods that are not covered by the interface. + /// [Browsable(false)] - IFunctionHandle Handle { get; } + new IFunctionHandle Handle { get; } } \ No newline at end of file diff --git a/src/YaNco.Core/Connection.cs b/src/YaNco.Core/Connection.cs index f5b3b01..3aa7a34 100644 --- a/src/YaNco.Core/Connection.cs +++ b/src/YaNco.Core/Connection.cs @@ -28,6 +28,7 @@ public class Connection : IConnection _runtime.Env.Source, _runtime.Env.Settings)); public IHasEnvRuntimeSettings ConnectionRuntime => _runtime; + public IConnectionHandle Handle => _connectionHandle; public Connection( RT runtime, diff --git a/src/YaNco.Core/ConnectionPlaceholder.cs b/src/YaNco.Core/ConnectionPlaceholder.cs index 1d2b13d..c783f72 100644 --- a/src/YaNco.Core/ConnectionPlaceholder.cs +++ b/src/YaNco.Core/ConnectionPlaceholder.cs @@ -85,5 +85,5 @@ public EitherAsync GetAttributes() [Obsolete(Deprecations.RfcRuntime)] public IRfcRuntime RfcRuntime { get; } = new RfcRuntime(SAPRfcRuntime.Default); public IHasEnvRuntimeSettings ConnectionRuntime { get; } = SAPRfcRuntime.Default; - + public IConnectionHandle Handle { get; } } \ No newline at end of file diff --git a/src/YaNco.Core/DataContainer.cs b/src/YaNco.Core/DataContainer.cs index f1fe962..d8a86b2 100644 --- a/src/YaNco.Core/DataContainer.cs +++ b/src/YaNco.Core/DataContainer.cs @@ -53,6 +53,8 @@ public Either GetTypeDescription() return IO.GetTypeDescription(_handle); } + public IDataContainerHandle Handle => _handle; + protected virtual void Dispose(bool disposing) { if (disposing) diff --git a/test/SAPSystemTests/Program.cs b/test/SAPSystemTests/Program.cs index c8af238..82c0bc0 100644 --- a/test/SAPSystemTests/Program.cs +++ b/test/SAPSystemTests/Program.cs @@ -173,6 +173,20 @@ from userName in getValue(structure["FULLNAME"]) result = await withFieldMapping.Run(SAPRfcRuntime.Default); Console.WriteLine("call_getFullName_with_abapValue: " + result); + + var paramsCall = useConnection(connectionEffect, connection => + from getUserFunction in connection.CreateFunction("BAPI_USER_GET_DETAIL").ToAff(l=>l) + from rt in Prelude.runtime() + from functionEff in rt.RfcFunctionsEff + from dataEff in rt.RfcDataEff + from funcDescription in functionEff.GetFunctionDescription(getUserFunction.Handle).ToEff(l => l) + from userParam in functionEff.GetFunctionParameterDescription(funcDescription, "USERNAME").ToEff(l=>l) + from paramsParam in functionEff.GetFunctionParameterDescription(funcDescription, "PARAMETER").ToEff(l => l) + select (UserName: userParam, Params: paramsParam)); + + var paramsResult = await paramsCall.Run(SAPRfcRuntime.Default); + Console.WriteLine("call_getParams_with_connection: " + paramsResult); + return; static RfcError Callback(string command)