I am trying to duplicate some old Epicor 10.1 customization code in a function with C# in kinetic. In the old code there are some internal classes that are referenced. Is there a way to do this in the function C# code or do I have to figure out what each internal class does and try to write in one function without internal class(s)? If I can declare internal classes in function code, could someone please guide me in where to find an example.
I would try re-writing it as a function library, or if its very complicated and you really want classes, turn it into an external REST API you call from functions.
I don’t know of a way to have classes in a function library, if you find a way its going to be an unsupported hack I think.
I agree with Evan. You really can’t have internal classes in Functions at this time. The best workarounds I’ve seen is in this post from the two Kevins.
Func
and Action
delegates are extremely useful as local methods (There’s an example of Func
on the first post linked by @Mark_Wonsil - Action
is basically the same, but always returns void
)
If you don’t need to pass the data around - just using it within the function - you could use anonymous types to bundle your data together:
var thisObj =
new {
Title = "some string", // String
Balance = 100.94M, // Decimal type
Data = ds.OrderHed // DataTable
}
assert thisObj.Title == "some string";