2010-12-19 6 views
0

caliburn.micro에서 caliburn으로 프로젝트를 변환해야합니다. 부트 스트 래퍼 클래스에 문제가 있습니다.Caliburn.Micro에서 "normal"로 프로젝트를 변환 할 때의 문제 Caliburn

I는 다음과 같이 caliburn.micro :

public class MefBootStrapper : BootStraper<IShellViewModel> 
{ 
#region Fields 
private CompositionContainer _container; 
#endregion 

#region Overrides 
protected override void Configure() 
{ // configure container 
#if SILVERLIGHT 
    _container = CompositionHost.Initialize(
    new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>())); 
#else 

    var catalog = 
     new AggregateCatalog(
      AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()); 

    //add external DLL 
    catalog.Catalogs.Add(
     new AssemblyCatalog(string.Format(
      CultureInfo.InvariantCulture, "{0}{1}", System.IO.Directory.GetCurrentDirectory(), @"\Pokec_Toolkit.dll"))); 

    _container = new CompositionContainer(catalog); 
#endif 

    var batch = new CompositionBatch(); 

    batch.AddExportedValue<IWindowManager>(new WindowManager()); 
    batch.AddExportedValue<IEventAggregator>(new EventAggregator()); 
    batch.AddExportedValue(_container); 

    _container.Compose(batch); 
} 

protected override object GetInstance(Type serviceType, string key) 
{ 
    string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key; 
    var exports = _container.GetExportedValues<object>(contract); 

    if (exports.Count() > 0) 
    return exports.First(); 

    throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract)); 
} 

protected override IEnumerable<object> GetAllInstances(Type serviceType) 
{ 
    return _container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType)); 
} 

protected override void BuildUp(object instance) 
{ 
    _container.SatisfyImportsOnce(instance); 
} 

protected override IEnumerable<System.Reflection.Assembly> SelectAssemblies() 
{ 
    return base.SelectAssemblies(); 
} 
#endregion 
} 

내가 주입에 MEF를 사용합니다.

문제가 Caliburn에 존재하지 않습니다. BooStraper 클래스. 이 문제를 어떻게 해결할 수 있습니까?

외부 어셈블리에서로드 유형이 필요합니다.

감사합니다.

답변

0

최신 소스 코드를 사용하고 있습니까? 부트 스트 래퍼는 최근 Caliburn으로 다시 이식되었습니다.

관련 문제