Upgrading a C# application from Epicor 9 to Epicor 10 for file attachments

I am using the Attachment business object to add file attachments in E9 using the following code. The code works without an issue. I am trying to convert to E10 and I am having an issue.
E9 Code: Working
Epicor.Mfg.BO.Attachment a = new Epicor.Mfg.BO.Attachment(epicorSession.ConnectionPool);
AttachmentDataSet ads = new AttachmentDataSet();

        a.GetNewXFileAttch(ads, relatedtofile, ID, "1ah", "A", "", "", "");
        ads.XFileAttch[0].XFileRefNum = ds.XFileRef[0].XFileRefNum;
        a.Update(ads);

E10 Code: Issue with the definition of a so the code does not work.
Ice.Contracts.BO.Attachments a = new Ice.Contracts.BO.Attachments(epiSession);

                    AttachmentDataSet ads = new AttachmentDataSet();
                    a.GetNewXFileAttch(ads, relatedtofile, ID, "1ah", "A", "", "", "");
                    ads.XFileAttch[0].XFileRefNum = ds.XFileRef[0].XFileRefNum;
                    a.Update(ads);
                    Erp.Adapters.PartAdapter p = new Erp.Adapters.PartAdapter(oTrans);

I do not code very often and any help would be greatly appreciated.

Thanks

Amy Haas

This is how you would instantiate a (in this case) and other BO’s in C#

using Ice.BO;
using Ice.Proxy.BO;

AttachmentImpl attch = WCFServiceSupport.CreateImpl<AttachmentImpl>(epicorSession, AttachmentImpl.UriPath);

Thank you for the information. One of the parameters in the GetNewXfileAttch is the guid id. I am assuming this is the Part rev sysrowid. Do you know how I can get that?
Thanks,

Amy

using Ice.Proxy.Lib;

string whereClause = String.Format("PartNum = '{0}'", "** PartNum to Search **");
string columnList = "PartNum, SysRowID";

var session = (Ice.Core.Session)oTrans.Session; 
var bo = WCFServiceSupport.CreateImpl<BOReaderImpl>(session, BOReaderImpl.UriPath);
var ds = bo.GetList("Erp:BO:Part", whereClause, columnList);
				
MessageBox.Show(ds.Tables[0].Rows[0]["SysRowID"].ToString());

Needs references to these 2 dlls in Custom References:
image

It’s efficient. because it’s only bringing back the column you need.

I am getting an error at the oTrans.Session; oTrans does not exist in the current context
Thanks

Amy

I get that if I haven’t added the Custom Assemblies references.