Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using Input Context Data in Code

This area is still be being worked on.  For now you should prefer using the context objects through metadata rather than depending on them in code.  But some information is provided for now.  

...

The factory object will need to be injected through dependency injection, or explicitly asked for with the type resolver.  

Creating a new input context object

New input context objects can be created and registered with the framework using Dependency Injection. Context objects should implement the Endpoints.IInputContext interface. The class should be named {contextName}InputContext, where {contextName} is the value you plan on using in the metadata. If you want a context named UserCompanyInformation your class would be named UserCompanyInformationInputContext. You would register it with the DI container in your installer with the following call:

 

Code Block
languagec#
container.RegisterType<IInputContext, UserCompanyInformationInputContext>(typeof(UserCompanyInformationInputContext).FullName);

If you cannot conform to this naming convention you can override IInputContext resolution by registering your own instance of IInputContextFactory.

Considerations when creating new input context objects

The framework does no caching of the context object values after lookup. If the lookup is expensive it is on your implementation to ensure this is efficient enough to meet your needs. The number of context objects that exist and are cached will increase the memory footprint of your web server.