CallContext.Current.GetMainContext<ErpContext> no longer exists in 10.2.400

I’m currently going through the process of upgrading our 10.1.600 version to 10.2.400.
We have a lot of service customisations that were created using Service Designer. The service designer code created these customisations with the following class declarations as below. What can i use instead of CallContext.Current.GetMainContext() to get the ErpContext?

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public sealed class CslAMReportTypesSvcFacade : Epicor.Customization.Bpm.SvcFacadeBase<ErpContext, CslAMReportTypesSvcContract, CslAMReportTypesSvc>, CslAMReportTypesSvcContract
{
        public CslAMReportTypesSvcFacade()
            : this(CallContext.Current.GetMainContext<ErpContext>())
        {
        }
}
1 Like

I don’t have 10.2.400 infront of me now, but what if you open up Method Directives or Data Directives and click on the Advanced Programming - or - generate a new template using Service Designer in 10.2.400 to see what the new boilerplate generated looks like.

Thanks for replying @hkeric.wci. Thats was my next stop in trying to solve this. Thanks.

@richard.bremner did you resolve?

Hey hasokeric, thanks for the chase. Yes I managed to run the new service designer. It now doesn’t call the other constructor within it’s class but instead calls the base. I’m not sure what this means where the Context isn’t passed in but I’ll find out once everything is compiled.

    [System.CodeDom.Compiler.GeneratedCode("ServiceGenerator", "3.2.400.0")]
    [ServiceBehavior(InstanceContextMode = System.ServiceModel.InstanceContextMode.PerCall, ConcurrencyMode = System.ServiceModel.ConcurrencyMode.Multiple)]
    public sealed class CslAMReportTypesSvcFacade : Epicor.Customization.Bpm.SvcFacadeBase<ErpContext, CslAMReportTypesSvcContract, CslAMReportTypesSvc>, CslAMReportTypesSvcContract
    {
        #region Data members

        #endregion // Data members

        public CslAMReportTypesSvcFacade()
            : base("Erp:BO:CslAMReportTypes")
        {
        }

Code generated by the Service Designer such as the *SvcFacade.cs that you are looking at is not meant to be maintained by hand. In fact, it has a comment to that effect.

Regenerating your service from Service Designer should resolve the issue.

//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//
//     Changes to this file will be lost when regenerated
// </autogenerated>
//------------------------------------------------------------------------------
1 Like