internal static Lazy <T> CreateStronglyTypedLazyOfT <T>(Export export) { if (export is IDisposable disposable) { return(new DisposableLazy <T>( () => ExportServices.GetCastedExportedValue <T>(export), disposable, LazyThreadSafetyMode.PublicationOnly)); } else { return(new Lazy <T>(() => ExportServices.GetCastedExportedValue <T>(export), LazyThreadSafetyMode.PublicationOnly)); } }
internal static Lazy <T> CreateStronglyTypedLazyOfT <T>(Export export) { IDisposable disposable = export as IDisposable; if (disposable != null) { return(new DisposableLazy <T>( () => ExportServices.GetCastedExportedValue <T>(export), disposable)); } else { return(new Lazy <T>(() => ExportServices.GetCastedExportedValue <T>(export), false)); } }
internal static Lazy <T, M> CreateStronglyTypedLazyOfTM <T, M>(Export export) { if (export is IDisposable disposable) { return(new DisposableLazy <T, M>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), disposable, LazyThreadSafetyMode.PublicationOnly)); } else { return(new Lazy <T, M>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), LazyThreadSafetyMode.PublicationOnly)); } }
internal static Lazy <T, M> CreateStronglyTypedLazyOfTM <T, M>(Export export) { IDisposable disposable = export as IDisposable; if (disposable != null) { return(new DisposableLazy <T, M>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), disposable)); } else { return(new Lazy <T, M>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), false)); } }
internal static Lazy <object, object> CreateSemiStronglyTypedLazy <T, M>(Export export) { IDisposable disposable = export as IDisposable; if (disposable != null) { return(new DisposableLazy <object, object>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), disposable, LazyThreadSafetyMode.PublicationOnly)); } else { return(new Lazy <object, object>( () => ExportServices.GetCastedExportedValue <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), LazyThreadSafetyMode.PublicationOnly)); } }