Is there a .NET library available that lays on top of BOI COM implementation?

I recently took the BOI course on SageU and have been educating myself in how to use the BOI COM interface. I'm finding that there seems to be a real need for a .NET (or CLR) library that abstracts away the COM implementation so that we can just work with real .NET objects in our code. This is different from the DispatchObject which is just a generic wrapper around COM objects. I'm looking for first class .NET objects that represent the underlying COM objects and have Intellisense and manage references and memory under the hood. Does anyone know if there is such a library available?

  • in reply to Bret

    Any chance of a sample sometime or some documentation? Glad to hear it's actively maintained / up to date. I'll start poking at it. 

  • in reply to wishingforsql

    The Sage100.ObjectManagement code is pretty well documented, and here is a real simple example of creating a customer and then deleting it.

    using Sage100.ObjectManagement;
    using Sage100.ObjectManagement.Interfaces;
    using System;
    using System.Net;
    
    namespace SageCityDemo
    {
        class Program
        {
            static void Main(string[] args)
            {
                var homePath = @"C:\Sage\Sage 100 Advanced\MAS90\Home";
                var userName = "test";
                var password = "pa$$word";
                var companyCode = "ABC";
    
                var sessionLogon = new SessionLogon
                {
                    CompanyCode = companyCode,
                    UserLogon = new NetworkCredential { UserName = userName, Password = password },
                    ModuleCode = ModuleNames.AccountsReceivable,
                    ModuleDate = DateTime.Today
                };
    
                using (var sySession = new MasSession(homePath))
                {
                    sySession.InitSession(sessionLogon);
    
                    using (var arCustomer = sySession.CreateObject<IMasBusinessObject>("AR_Customer_bus", "AR_Customer_ui", "A/R"))
                    {
                        arCustomer.SetKeyValue(AR.DivColumn, "01");
                        arCustomer.SetKeyValue(AR.CustomerColumn, "BOITEST");
                        arCustomer.SetKey();
    
                        arCustomer.SetValue("SalesPersonDivisionNo$", "01");
                        arCustomer.SetValue("SalesPersonNo$", "0100");
    
                        if (!arCustomer.Write()) { Console.WriteLine($"New customer not created. {arCustomer.LastErrorMessage}"); }
    
                        arCustomer.SetKeyValue(AR.DivColumn, "01");
                        arCustomer.SetKeyValue(AR.CustomerColumn, "BOITEST");
                        arCustomer.SetKey();
    
                        if (!arCustomer.Delete()) { Console.WriteLine($"The customer delete failed. {arCustomer.LastErrorMessage}"); }
                    }
                }
            }
        }
    }

    Thank you!

  • in reply to Bret

    Excellent thanks! I've been getting along with BOI, it's just very verbose in c#. I think I see enough of the intended implementation of the nuget to see the philosophy.  Is there any documentation for the nuget outside of the xml? I haven't found it.  

  • I am trying to use this library wrapper and can't see how I can initialize and/or insert lines for a sales order. Below is the code I have - after initiating the session.I am not sure if the lines object are within the salesorder (header) object or I should initialize a "lines" object.

    Any help would be greatly appreciated.  

    Is there documentation for this library?

    Using sySession = New MasSession(homePath)
    sySession.InitSession(sessionLogon)

    Using sorder = sySession.CreateObject(Of IMasBusinessObject)("SO_SalesOrder_bus", "SO_SalesOrder_ui", "S/O")
    sorder.SetValue("SalesOrderNo$", "TEST01")
    sorder.SetValue("ARDivisionNo$", "01")
    sorder.SetValue("CustomerNo$", "ABF")
    sorder.SetValue("OrderDate$", "04152024")
    sorder.SetValue("ItemCode$", "1001-HON-H252")

    sorder.SetKey()

    '??Should I do the sordeline below?


    'Using sorderline = sySession.CreateObject(Of IMasBusinessObject)("SO_SalesOrderLines_bus", "SO_SalesOrderLines_ui", "S/O")
    ' sorderline.SetValue("ItemCode$", "1001-HON-H252")
    ' sorderline.SetValue("QuantityOrdered$", "1.00")
    ' sorderline.SetValue("WarehouseCode$", "001")
    ' sorderline.SetKey()
    'End Using

    If not sorder.Write() Then
       Console.WriteLine($"New Order not created. {sorder.LastErrorMessage}")
    End If
    End Using
    End Using