We upgraded our pilot system this weekend to 2022.1.1 / Base Version 11.2.100.0 / 4.2.100.0. With this upgrade we are now getting an error on one of our customizations:
“Error: CS0308 - line 86 (848) - The non-generic type ‘Epicor.ServiceModel.Channels.ImplBase’ cannot be used with type arguments”
Kinetic no longer uses the Windows Communication Foundation (WCF) framework to manage service calls between the server, clients, and web applications. The system uses ASP.NET Web API instead.
I’m surprised the WCFServiceSupport class exists at all.
I could be wrong, but if you are invoking this from an epicor customization you ought to use the adapters and not invoke the assembly manually. Second, if this isn’t inside epicor and you’re calling epicor business objects, consider using the rest services or functions to orchestrate. Are we correct to assume this is an old customization in tbe epicor app or is it outside?
I am working on a customization with the same issue after the upgrade. In my previous code I was using a line very similar to yours to pull a value from a BAQ that returns a single value.
Previously this worked:
private int getLastUNID()
{
using (var svc = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>((Ice.Core.Session)oTrans.Session,Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicQuerySvcContract>.UriPath))
{
var qeds = new QueryExecutionDataSet();
DataSet baq = svc.ExecuteByID("LastCPIUNID", qeds);
if (Convert.ToString(baq.Tables["Results"].Rows[0]["Calculated_LastUNID"]) == "")
{
return 0;
}
else
{
return (int)baq.Tables["Results"].Rows[0]["Calculated_LastUNID"];
}
}
}
So I referred to this post and found your link. After trying the syntax on that page, I have the following:
fantastic solution @NateS@Mark_Wonsil@Aaron_Moreng@josecgomez , i have managed to use your conversion and it is working great on many classes, just this one i could not find the replacement for these WCFServiceSupport sub commands, any idea ?
I’m not sure I understand the question entirely, but utilizing the dynamic query adapter will allow you to interact with the results of the baq as a dataset and from there you can perform your selection/filter/count operations like so:
//Call a Dynamic Query (BAQ) adapter and return results to a grid
//This is especially useful when returning data to a custom grid without needing to format the column headers in code.
private void btnGet_Click(object sender, System.EventArgs args)
{
//use dynamic query to populate grdBPM
DynamicQueryAdapter adapterQuery = new DynamicQueryAdapter(oTrans);
adapterQuery.BOConnect();
adapterQuery.ExecuteByID("YourBAQIDHere");
DataSet ds = adapterQuery.QueryResults;
adapterQuery.Dispose();
grdDisplayResults.DataSource = ds;
}
//Call a Dynamic Query adapter with parameters
//Multiple parameters can be added, just add a new parameter row
private DataSet getInfoFromQuery(string partNum)
{
DataSet dsLots = new DataSet();
DynamicQueryAdapter qryAvailableLots = new DynamicQueryAdapter(oTrans);
QueryExecutionDataSet parameters = new QueryExecutionDataSet();
//set parameter: partNum
DataRow paramRow = parameters.ExecutionParameter.NewRow();
paramRow["ParameterID"] = "PartNum";
paramRow["ParameterValue"] = partNum;
paramRow["ValueType"] = "varchar(50)";
paramRow["IsEmpty"] = "False";
paramRow["RowMod"] = "";
parameters.ExecutionParameter.Rows.Add(paramRow);
qryAvailableLots.BOConnect();
qryAvailableLots.ExecuteByID("YourParamQueryHere", parameters);
dsLots = qryAvailableLots.QueryResults;
qryAvailableLots.Dispose();
return dsLots;
}
The query results are where you interact with the data returned from the dynamic query.
If we switch over to the adapter method as suggested, when does the adapter get disposed? I’ve always preferred the WCFServiceSupport method because the scope seems clearer to me. For some reason I thought that BOConnect() takes additional overhead and if it is called within a function, it will be attaching additional adapters to oTrans each time it’s run?
You can either manually dispose the adapter via the .Dispose() method or wrap the entire thing in a using statement. There is very little overhead with adapters and this is the proper way to invoke the Epicor BO APIs in a client customization
I’m also speaking from E10 experience, not Kinetic. I don’t know much about Kinetic client customizations, but you might check out functions for orchestration in lieu of adapters. Again, don’t want to misrepresent Kinetic if it is indeed fundamentally different
It’s not just Epicor. Microsoft has deprecated WCF in .NET 5+ and Kinetic server is .Net 6 so the future is REST for now (who knows, maybe gRPC in the near future for some things. ).
It is a much better practice to put your business logic server-side and not hit repositories directly from the client and functions are a great way to do this.
Unfortunately I’m still running 10.2.300 so functions are not available yet. When we upgrade to Kinetic we know the screens will be totally different. Hoping to move these WCF customizations into functions over time if possible