Skip to content

Conversation

@MIchaelMainer
Copy link
Collaborator

@MIchaelMainer MIchaelMainer commented Jan 31, 2019

Typewriter can now support properties to be specified from the CLI and used in the templates. This option should only be used when:

  • We can't update target metadata either by having workload teams fix their metadata, or by alteration with the metadata preprocessor.
  • We can't make a fix in the templates or template logic by themselves.
  • We need to inject control data at runtime.

The specified properties can be accessed from the templates. We needed this for beta PHP file generation since it uses a different namespace.

The attached file demonstrates the file generated from the test case where it injects a custom namespace.
Entity.txt

Change summary

  • Updated the readme with information on the new command line option.
  • Updated the PHP model templates to access the property bag and inject a beta namespace if applicable.
  • Updated the ConfigurationService to accept the optional property bag and to update the templateWriterSettings in case we are running tests that target multiple languages in the same test suite. This last part is necessary since we are dealing with a lot of static members.
  • Updated the TemplateProcessor to always provide a new T4 host. This is required as we need to update the host so that the appropriate language specific *CodeWriter.cs is used in the template processor and accessed from the templates.
  • Updated tests and test metadata.

…in a test run for Typewriter. The TemplateProcessor host needs to be reset for the case when we target a new language. Otherwise the wrong *CodeWriter will be used and an unsupported cast will occur in the templates when trying to cast host.CodeWriter to the platform specific CodeWriter. The change to ConfigurationService.Settings is also required to reset the settings for configuring the TemplateWriter.
@MIchaelMainer MIchaelMainer reopened this Feb 6, 2019
@MIchaelMainer MIchaelMainer merged commit d8ffb4c into dev Feb 8, 2019
@MIchaelMainer MIchaelMainer deleted the mm/configObject branch February 8, 2019 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants