1

Currently there is the possibility to declare the metadata attribute collected for service implementations at service contract level. In my case, I have a pattern for a bunch of services and I need to use the same metadata attribute for all of them. Can I somehow declare the metadata attribute globally, so that the service contract definition looks cleaner?

Auguste Leroi
  • 215
  • 1
  • 7

1 Answers1

1

Yes, you can. Just do the following:

AppServiceContractAttribute.RegisterDefaultMetadataAttributeTypes(typeof(MyGreatMetadataAttribute));

Check https://github.com/kephas-software/kephas/wiki/Application-Services#registering-global-service-metadata-attributes for more details on that matter. I'll copy two notes from the wiki:

  • Important: make sure to register the metadata attributes before creating the composition container, otherwise this will have no effect.

  • Currently it is not possible to register a metadata attribute for a specific service, only globally.

ioan
  • 722
  • 4
  • 12