So we’re preparing to upgrade to 10.2.300 from 10.1.600 and I have some custom external code being called from BPMs due to clashing namespaces that is not compiling after I updated the references:
private Lazy<ErpContext> _db = new Lazy<ErpContext>(() => CallContext.Current.GetMainContext<ErpContext>());
private ErpContext Db
{
get { return _db.Value; }
}
This is giving me the DB reference to make some linq queries like I would do in custom C# widget of a BPM. But now I’m getting the following error:
CallContext' does not contain a definition for 'GetMainContext' and no accessible extension method 'GetMainContext' accepting a first argument of type 'CallContext' could be found (are you missing a using directive or an assembly reference?)
Looks like GetMainContext no longer exists in Current. Does anyone know if there’s still something equivalent so I don’t have to find a workaround?
I just wanted to add, you can also do it this way. I think it gets you some extra goodies. Like LogManager, Session, the Db property like you would have in the BPM designer. You also don’t have to add your own Db property.
public class JobReqDateUpdate : Ice.ContextBoundBase<Erp.ErpContext>
{
public JobReqDateUpdate(Erp.ErpContext context) : base(context)
{
}
}