Esempio n. 1
0
        private static RfcResultCode HandleGenericMetadata(RfcInterop interop, SapConnectionParameters parameters, string functionName, RfcAttributes attributes, out IntPtr funcDescHandle)
        {
            RfcConnectionParameter[] interopParameters = parameters.ToInterop();

            IntPtr connection = interop.OpenConnection(
                connectionParams: interopParameters,
                paramCount: (uint)interopParameters.Length,
                errorInfo: out RfcErrorInfo connectionErrorInfo);

            if (connectionErrorInfo.Code != RfcResultCode.RFC_OK)
            {
                funcDescHandle = IntPtr.Zero;
                return(connectionErrorInfo.Code);
            }

            funcDescHandle = interop.GetFunctionDesc(
                rfcHandle: connection,
                funcName: functionName,
                errorInfo: out RfcErrorInfo errorInfo);

            RfcResultCode resultCode = interop.CloseConnection(
                rfcHandle: connection,
                errorInfo: out RfcErrorInfo closeErrorInfo);

            return(errorInfo.Code);
        }
Esempio n. 2
0
        internal static void InstallGenericServerFunctionHandler(RfcInterop interop, SapConnectionParameters parameters, Action <ISapServerConnection, ISapServerFunction> action)
        {
            RfcResultCode resultCode = interop.InstallGenericServerFunction(
                serverFunction: (IntPtr connectionHandle, IntPtr functionHandle, out RfcErrorInfo errorInfo)
                => HandleGenericFunction(interop, action, connectionHandle, functionHandle, out errorInfo),
                funcDescPointer: (string functionName, ref RfcAttributes attributes, out IntPtr funcDescHandle)
                => HandleGenericMetadata(interop, parameters, functionName, attributes, out funcDescHandle),
                out RfcErrorInfo installFunctionErrorInfo);

            resultCode.ThrowOnError(installFunctionErrorInfo);
        }
Esempio n. 3
0
        internal static ISapServer Create(RfcInterop rfcInterop, SapConnectionParameters parameters)
        {
            RfcConnectionParameter[] interopParameters = parameters.ToInterop();

            IntPtr rfcServerHandle = rfcInterop.CreateServer(
                connectionParams: interopParameters,
                paramCount: (uint)interopParameters.Length,
                errorInfo: out RfcErrorInfo errorInfo);

            errorInfo.ThrowOnError();

            return(new SapServer(rfcInterop, rfcServerHandle, parameters));
        }
Esempio n. 4
0
 // Constructor for unit-testing
 internal SapConnection(RfcInterop interop, SapConnectionParameters parameters)
 {
     _interop    = interop;
     _parameters = parameters;
 }
Esempio n. 5
0
 public SapConnection(string connectionString)
     : this(new RfcInterop(), SapConnectionParameters.Parse(connectionString))
 {
 }
Esempio n. 6
0
 public SapConnection(SapConnectionParameters parameters)
     : this(new RfcInterop(), parameters)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Installs a global server function handler.
 /// </summary>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="action">The RFC server function handler.</param>
 public static void InstallGenericServerFunctionHandler(string connectionString, Action <ISapServerConnection, ISapServerFunction> action)
 {
     InstallGenericServerFunctionHandler(SapConnectionParameters.Parse(connectionString), action);
 }
Esempio n. 8
0
 /// <summary>
 /// Creates and connects a new RFC Server.
 /// </summary>
 /// <param name="parameters">The connection parameters.</param>
 /// <returns>The SAP RFC Server.</returns>
 public static ISapServer Create(SapConnectionParameters parameters)
 {
     return(Create(new RfcInterop(), parameters));
 }
Esempio n. 9
0
 /// <summary>
 /// Creates and connects a new RFC Server.
 /// </summary>
 /// <param name="connectionString">The connection string.</param>
 /// <returns>The SAP RFC Server.</returns>
 public static ISapServer Create(string connectionString)
 {
     return(Create(SapConnectionParameters.Parse(connectionString)));
 }
Esempio n. 10
0
 private SapServer(RfcInterop interop, IntPtr rfcServerHandle, SapConnectionParameters parameters)
 {
     _interop         = interop;
     _rfcServerHandle = rfcServerHandle;
     _parametes       = parameters;
 }
Esempio n. 11
0
 /// <summary>
 /// Installs a global server function handler.
 /// </summary>
 /// <param name="parameters">The connection parameters.</param>
 /// <param name="action">The RFC server function handler.</param>
 public static void InstallGenericServerFunctionHandler(SapConnectionParameters parameters, Action <ISapServerConnection, ISapServerFunction> action)
 {
     InstallGenericServerFunctionHandler(new RfcInterop(), parameters, action);
 }