Filtering Imports by a license check.

Aug 6, 2009 at 3:26 PM

Hi,

    Before a part is imported successfully, i would like to perform a license check on the part - If the license is found and validated then i can allow part to be created. Is there a way i can do this?

 

Thanks

Rama.

Aug 6, 2009 at 5:01 PM

Hi Rama,

There are two possibilities you can consider.

If the license is based on Part of Export metadata, consider filtering the ComposablePartCatalog before you initialise the container with it.

If the license is based on code signing, assemblies, or types, consider filtering the Types or Assemblies before creating a catalog from them.

Cheers,

Nick

Aug 6, 2009 at 10:01 PM

Thanks very much for your reply.

 

Hi Nick,

     The license is for the whole feature. In my case each application implements an interface if you will IFeature and before i import this I feature into my host i would like to check with our licensemanager if this feature is licensed. If it is not licensed i want to make sure that this feature interface is not available for consumption, so the entire type is not available. Ideally i would like to do this before the component is created. In MEF when types are imported are those types created right upfront (all assemblies laoded and types created)  or they loaded on demand. If they are demand loaded i can potentially implement my license checks at the point before the types are created.

 

Thanks

Rama.

Aug 6, 2009 at 10:43 PM

Hi Rama

Types are not instantiated until they are actually needed and catalogs are the key point where assembly loading occurs. Within a custom catalog, you can apply custom filtering as to which assemblies / types will be loaded. I’d recommend looking into creating a custom catalog that internally scans and determines which assemblies / types the license allows and creates Type/Assembly catalogs to load the parts in.

Glenn

From: nadendla [mailto:notifications@codeplex.com]
Sent: Thursday, August 06, 2009 3:01 PM
To: Glenn Block
Subject: Re: Filtering Imports by a license check. [MEF:64728]

From: nadendla

Thanks very much for your reply.

Hi Nick,

The license is for the whole feature. In my case each application implements an interface if you will IFeature and before i import this I feature into my host i would like to check with our licensemanager if this feature is licensed. If it is not licensed i want to make sure that this feature interface is not available for consumption, so the entire type is not available. Ideally i would like to do this before the component is created. In MEF when types are imported are those types created right upfront (all assemblies laoded and types created) or they loaded on demand. If they are demand loaded i can potentially implement my license checks at the point before the types are created.

Thanks

Rama.

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Aug 7, 2009 at 12:40 AM

Thanks very much Glenn.