Silverlight4には次のシナリオがあります。
通知サービスがあります
スニペット
[InheritedExport]
public interface INotificationsService : IObservable<ReceivedNotification>
{
void IssueNotifications(IEnumerable<ClientIssuedNotification> notifications);
}
およびこのサービスの実装Snippet
[PartCreationPolicy(CreationPolicy.NonShared)]
public class ClientNotificationService : INotificationsService
{
[Import]
IPlugin Plugin { get; set; }
...
}
ClientNotificationServiceのPluginプロパティは、INotificationsServiceをインポートするインポートクラスによって提供される必要があることをMEFにどのように伝えることができますか。
例えば:
スニペット
public class Client
{
[Export]
IPlugin Current { get; set; }
[Import]
INotificationService NotificationService;
}
MEFがClientクラスによってエクスポートされたIPluginでClientNotificationService.Plugin部分を満たすようにするにはどうすればよいですか。
基本的に、NotificationServiceは、インポートするクラスによって提供される一意のIDを受け取り、新しいクラスが作成および作成されるたびに、またはメタデータを使用してこれを行うなどの代替メソッドがある場合は、洞察をいただければ幸いです。私はしばらくこれに苦労してきました。
ありがとう