# Epicor 10.2: There is no argument given that corresponds to the required formal parameter 'dataContext' of 'ContextBoundBase\<ErpContext\>.ContextBoundBase(ErpContext)'

**URL:** <https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354>\
**Category:** Epicor ERP 10\
**Tags:** e10\
**Created:** [January 23, 2018, 12:56pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354 "2018-01-23T12:56:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [January 23, 2018, 12:56pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/1 "2018-01-23T12:56:14Z")

</div>

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)'**

NOTE: For E10.1.600 not getting such error.

Any solution for this error!!..

THANKS in advance

---

<div class="post-metadata">

**Author:** ![josecgomez](https://www.epiusers.help/user_avatar/www.epiusers.help/josecgomez/32/55731_2.png) [@josecgomez](https://www.epiusers.help/u/josecgomez)\
**Post date:** [January 23, 2018, 2:15pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/2 "2018-01-23T14:15:23Z")

</div>

What existing object… what are you referring to specifically?  
SDK Work ? Adapter, BO? Customization? BPM? Report? BAQ? Data Directive?

---

<div class="post-metadata">

**Author:** ![Bart\_Elia](https://www.epiusers.help/user_avatar/www.epiusers.help/bart_elia/32/38379_2.png) [@Bart\_Elia](https://www.epiusers.help/u/Bart_Elia)\
**Post date:** [January 23, 2018, 2:16pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/3 "2018-01-23T14:16:48Z")

</div>

Code snippet would be wonderful too 🙂

---

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [January 23, 2018, 4:20pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/4 "2018-01-23T16:20:49Z")

</div>

Hello Josecgomez,  
This code for making DLL to be called as external reference by the BPM, which is validate for the Commitment control.

Below is the code:

![global_error](https://epiusers.help/uploads/default/original/2X/8/8b1be4a58667d972cddefc7a17cd4d0a15911409.png)

Same code is works in Epicor-10.1.600.18 but it is failing in E-10.2

---

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [January 23, 2018, 4:21pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/5 "2018-01-23T16:21:09Z")

</div>

And below with the error:

 ![global_error](https://epiusers.help/uploads/default/original/2X/f/f0379b2d671380d50179483f81e576bb35a47005.png)

---

<div class="post-metadata">

**Author:** ![Bart\_Elia](https://www.epiusers.help/user_avatar/www.epiusers.help/bart_elia/32/38379_2.png) [@Bart\_Elia](https://www.epiusers.help/u/Bart_Elia)\
**Post date:** [January 24, 2018, 12:18am UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/6 "2018-01-24T00:18:42Z")

</div>

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)

but I may be missing something

---

<div class="post-metadata">

**Author:** ![surendrapal](https://www.epiusers.help/user_avatar/www.epiusers.help/surendrapal/32/6162_2.png) [@surendrapal](https://www.epiusers.help/u/surendrapal)\
**Post date:** [January 24, 2018, 1:20am UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/7 "2018-01-24T01:20:29Z")

</div>

based on my understanding replace line number 33 with **public class GlobalProcedures** and try

---

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [February 6, 2018, 11:50am UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/8 "2018-02-06T11:50:17Z")

</div>

Dear @Bart_Elia,

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.

> foreach (var DataGetGlobalData in Db.ExecuteStoreQuery("Sp\_storeProcedureName " + “@code = {0}”, code))  
> {  
> ParamValue = Convert.ToString(DataGetGlobalData.Value);  
> }

**Facing Run-time Error: ‘Object reference not set to an instance of an object’**

Thanks & Regards…

---

<div class="post-metadata">

**Author:** ![Bart\_Elia](https://www.epiusers.help/user_avatar/www.epiusers.help/bart_elia/32/38379_2.png) [@Bart\_Elia](https://www.epiusers.help/u/Bart_Elia)\
**Post date:** [February 6, 2018, 3:21pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/9 "2018-02-06T15:21:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [February 7, 2018, 5:27am UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/10 "2018-02-07T05:27:45Z")

</div>

> [@sanjeev.gupta](#):
>
> This code for making DLL to be called as external reference by the BPM

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.**

---

<div class="post-metadata">

**Author:** ![sanjeev.gupta](https://www.epiusers.help/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@sanjeev.gupta](https://www.epiusers.help/u/sanjeev.gupta)\
**Post date:** [February 7, 2018, 9:44am UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/11 "2018-02-07T09:44:29Z")

</div>

> [@surendrapal](#):
>
> public class GlobalP

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:

> foreach (var DataGetGlobalData in Db.ExecuteStoreQuery("Sp\_storeProcedureName " + “@code = {0}”, code))  
> {  
> ParamValue = Convert.ToString(DataGetGlobalData.Value);  
> }

---

<div class="post-metadata">

**Author:** ![mahesh.deore](https://www.epiusers.help/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@mahesh.deore](https://www.epiusers.help/u/mahesh.deore)\
**Post date:** [February 16, 2018, 12:23pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/12 "2018-02-16T12:23:38Z")

</div>

**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#

> foreach (var DataGetGlobalData in Dbctx.ExecuteStoreQuery("Sp\_storeProcedureName " + “@code = {0}”, code))  
> {  
> ParamValue = Convert.ToString(DataGetGlobalData.Value);  
> }

---

<div class="post-metadata">

**Author:** ![Bart\_Elia](https://www.epiusers.help/user_avatar/www.epiusers.help/bart_elia/32/38379_2.png) [@Bart\_Elia](https://www.epiusers.help/u/Bart_Elia)\
**Post date:** [February 16, 2018, 1:11pm UTC](https://www.epiusers.help/t/epicor-10-2-there-is-no-argument-given-that-corresponds-to-the-required-formal-parameter-datacontext-of-contextboundbase-erpcontext-contextboundbase-erpcontext/42354/13 "2018-02-16T13:11:55Z")

</div>

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??
