Implementing a catalog

Feb 4, 2009 at 2:17 PM
Edited Feb 4, 2009 at 8:33 PM

I'm trying to implement a catalog, but when I override the GetExport methods, the definition is not correct. I use the attibutedmodel, and am expecting only one export. However, the Cardinality on the import definition tells me it is a ZeroOrMore. However, the _cardinality member is saying ExactlyOne. Is this a bug ?

EDIT : Actually, the problem was that my Import was using an interface implementing IEnumerable<T>. I have a IService interface which has some properties (represented internally by a dictionary), so my IService should be IEnumerable<KeyValuePair<string,object>>, but my service is then considered as a collection where as it should not be. Is there a workaround for this ?
Feb 4, 2009 at 8:45 PM
We are working on improving this so you will be able to explicitly state whether you want multiple items imported or not, instead of having it inferred based on the type.

For now, if your contract implements IEnumerable, you would have to import a list of your contract:

public IEnumerable<MyEnumerableContract> MyImport { get; set; }

Feb 12, 2009 at 1:16 PM

Thank you for your help.

Just for your information, you may would like to know that my catalog I was developping is now achieved.

You may find it here : Bonjour .NET