Skip to content
On this page

Validating Container Configuration

To find any potential holes in your Lamar configuration like missing dependencies, unclear defaults of service types, validation errors, or just plain build errors, you can use this method below:

cs
container.AssertConfigurationIsValid();

snippet source | anchor

Running this method will walk over every single registration in your Container and:

  1. Try to create a build plan for that Instance that will flush out any problems with missing dependencies or invalid inline configuration
  2. Try to build every single configured Instance
  3. Call any methods on built objects decorated with the [ValidationMethod] attribute to perform environment tests. See environment tests for more information on this usage.

If Lamar encounters any errors of any kind during this method, it will throw an exception summarizing all of the problems that it encountered.