I am trying to build my existing objects for Epicor 10.2. Here taking all the references with respect to E10.2
Getting the below error message at the time of build: There is no argument given that corresponds to the required formal parameter ‘dataContext’ of 'ContextBoundBase.ContextBoundBase(ErpContext)'
Line 38 is wrong - not sure why it ever worked to be honest. Possibly something specific to the service. If you are deriving the class off CBB then the ctor needs to be the same Type - ErpContext.
I assume line 38 should be:
public GlobalProcedures(ErpContext context)
Thanks for your suggestion.
I have been changed the code as per your suggestion & also added :base(context). Code has build successfully, but it is showing an error while trying to execute User defined Stored Procedure. Code is not reaching inside the For Each loop due to Db is getting Null.
Below is a code which we are using.
ok, I think I misspoke. You are doing this for BPM External Method? Sorry, I was thinking of the Externalization framework so my statement was invalid…
If you are calling the external Method, the ‘Create API’ will generate a POCO - no base class. The DB Context will be passed to you. There is no need to derive off ContextBoundBase unless you are creating new services and libraries. I work with a lot of partners - internal and external - who go into creating whole new products on the SDK so was not thinking about the BPM aspect.
If doing a simple External Method than generate the API from the Actions on the main page and it will give you something like this (This is from UserFIle)
namespace BpmCustomCode
{
public class MyUserFile
{
private Ice.IceContext dataContext;
public MyUserFile(Ice.IceDataContext context)
{
//
// TODO: should not be disposed, as custom assembly does not own the context
//
this.dataContext = (Ice.IceContext)context;
}
public void Update(Ice.Tablesets.UserFileTableset ds, Ice.Tablesets.ContextTableset context)
{
//
// TODO: Replace the throw statement with any code for an action in UserFile.Update() method invoke
//
throw new System.NotImplementedException();
}
}
}
You should be able to just drop in your logic in the method you specified when creating the BPM or create local, private methods for your logic.
Thanks @Bart_Elia…
I am writing this code for making DLL to be called as external reference from the BPM on Update method. Shared sample code is working for Epicor 10.1, but failing in 10.2. Above mentioned code has been written in external DLL & then this external DLL used in BPM code as a reference.
If I remove Inheritance of Context, I will not get Db Object to access the objects of Database. Basically, I want to execute user defined stored procedure using current data-Context connection from external DLL.
Thanks @surendrapal for reply… If I remove inheritance of ContextBoundBase then I am unable to access Db object.
Basically I want to execute user defined stored procedure using current db context connection.
Below mentioned code is used to execute stored procedure:
I have just created a object of ErpContext class & used to execute user defined stored procedure. And solution is worked for me. I got the dbContext object with database objects.
ErpContext Dbctx = new ErpContext();
and then I have used above Dbctx object to execute stored procedure from c#
I have no issue as well. I am still trying to understand where this code was being executed from and how It does not align with an External Method in a BPM so confuses me. How was that code instantiated??