@MichaelShirk after re-reading your initial question I think I know what is the problem. I haven’t noticed first time that you are injecting not in graph but in a normal C# type - your data service.
You see, the InjectDependency
mechanism supports DI injection only in graphs, graph extensions, Acumatica attributes derived from PXEventSubscriberAttribute
, and custom graph views and actions. You can’t inject into a regular C# type with this mechanism.
On the other hand, all is not lost. On the contrary, you can use normal DI constructor injection with Autofac framework. You can read more here, basically, you can scroll to the constructor injection:
https://www.devleader.ca/2023/08/22/dependency-injection-how-to-start-with-autofac-the-easy-way/
You just need to add a parameter to your data service , so it would look like this:
public class SWZohoDataService : ISWZohoDataService
{
private readonly PXGraph _graph;
private readonly ISWZohoAuthService _authService;
public SWZohoDataService(ISWZohoAuthService authService)
{
_authService = authService;
_graph = PXGraph.CreateInstance<PXGraph>();
}
}