简体   繁体   中英

Are there any Prism “Post-build” Event or method while using MEF?

I have 4+ imported properties in a class and some code that needs at least 4 properties to execute

Are there any PRISM or MEF events that would help instead of putting notify on each setter and then checking for nulls ?

You can have your class implement the IPartImportsSatisfiedNotification interface. Then the OnImportsSatisfied method will be called once all the imports have been satisfied. Put your "post-build" code in this method.

This way you know all your parts have been imported and that it is safe to use them.

You can use an Aspect Orientated Programming language, such as Spec#, see http://specsharp.codeplex.com/

This will allow you to place an attribute on the class, and spec# will add the notify property changed as a post build event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM