Repository navigation
Policies
zehavibarak edited this page Jan 9, 2024
·
3 revisions
A policy is a means to manage programmable parameters via Architecture admin tool, and retrieve the settings by code.
[Policy(Name = "my-policy")]
public class MyPolicy : PolicyBase {
[Designer, Display(Name = "My check")]
public bool MyCheck { get; set; }
}Programmer can use property annotations to control layout like the example above.
To access the settings programmatically, inject ComponentInitializer.
public class MyClass {
public MyClass(ComponentInitializer initializer) {
var policy = initializer.GetInstance<MyPolicy>();
}
}Alternatively, programmer may provide a custom Angular layout using the class Designer attribute.
@BizDoc({ template: 'my-policy' })
@Component({ template: `<form>...
</form>`})
export class MyTemplateComponent implements PolicyComponent {
readonly form = new FormControl({
myCheck = new FormControl(false)
});
}Moding Ltd.