Skip to content

relativitydev/ads-dependency-injection

Repository files navigation

ADS Dependency Injection

This sample ADS application demonstrates how to do dependency injection with the different ADS platform extensibility points.

Note: Dependency Injection for Event Handlers is the same as Agents, so the examples are omitted here.

Dependency Injection

Dependency Injection is a specific implementation of Dependency Inversion, one of the five S.O.L.I.D. object-oriented principles.

The internet is full of excellent documentation on the topic, but here are a few specific links:

Dependency Injection in Kepler services

Relativity's Kepler framework supports Dependency Injection with Castle Windsor. Support is fully documented in the Relativity Developer Documentation.

See SampleApplication.Service.MyService for a sample implementation.

Dependency Injection in Custom Pages

Because the Custom Page sample is an ASP.NET MVC project, Castle Windsor Dependency Injection can be wired into the MVC application itself. This can be used at the unit testing level, to inject mocked classes. This can also be used at the test harness level.

See SampleApplication.CustomPage.Controllers.HomeController.cs and the SampleApplication.CustomPage.IoC folder for more information.

Dependency Injection in Agent and EventHandler extensibility points

Agent and EventHAndler extensibility points don't have built-in support for Dependency Injection, but it is still possible. Two variations of a technique for implementing Dependency Injection are shown in SampleApplication.Agent.MyAgent. The technique leverages the Lazy<T> class to delay DI Container resolution.

Building and Running

The code here compiles and can be tested in Visual Studio 2022. It references packages available on nuget.org.

The Agent and Service assemblies need to be uploaded to Relativity as Resource Files, and the CustomPage needs to be published, zipped, and uplaoded to Relativity as a Custom Page.

About

A sample ADS application with Dependency Injection wired up for the extensibility points

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published