Quantcast
Channel: Microsoft "Roslyn" CTP forum
Viewing all articles
Browse latest Browse all 504

Cannot get IRenameService instance through the following way

$
0
0

Dear All,

I am trying to get the IRenameService through the following way of MEF import:

public class ServiceArchive
    {
        [Import]
        public IRenameService RenameService { get; set; }

        private static ServiceArchive instance;

        private void compose()
        {
            var catalog = new AssemblyCatalog(Assembly.GetAssembly(typeof(IRenameService)));
            var container = new CompositionContainer(catalog);
            container.ComposeParts(this);
         }

        public static ServiceArchive GetInstance()
        {
            if (instance == null)
            {
                instance = new ServiceArchive();
                instance.compose();
            }
            return instance;
        }
    }

However, the renameService field is always null. Do you have any idea about why that?

Thanks!

Xi


Viewing all articles
Browse latest Browse all 504

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>