public static bool IsViewTypeValid(Type metadataViewType) { Assumes.NotNull(metadataViewType); // If the Metadata dictionary is cast compatible with the passed in type if (ExportServices.IsDefaultMetadataViewType(metadataViewType) || metadataViewType.IsInterface || ExportServices.IsDictionaryConstructorViewType(metadataViewType)) { return(true); } return(false); }
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)); } }
public static bool IsViewTypeValid(Type metadataViewType) { if (metadataViewType == null) { throw new ArgumentNullException(nameof(metadataViewType)); } // If the Metadata dictionary is cast compatible with the passed in type if (ExportServices.IsDefaultMetadataViewType(metadataViewType) || metadataViewType.IsInterface || ExportServices.IsDictionaryConstructorViewType(metadataViewType)) { return(true); } return(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)); } }
internal static Lazy <object, object> CreateSemiStronglyTypedExport <T, M>(Export export) { IDisposable disposable = export as IDisposable; if (disposable != null) { return(new DisposableLazy <object, object>( () => ExportServices.GetExportedValueFromLazy <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), export as IDisposable)); } else { return(new Lazy <object, object>( () => ExportServices.GetExportedValueFromLazy <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata), false )); } }
private static object CreateStronglyTypedExportFactoryOfTM <T, M>(Export export) { return(new ExportFactory <T, M>( () => ExportServices.GetExportLifetimeContextFromExport <T>(export), AttributedModelServices.GetMetadataView <M>(export.Metadata))); }
private static object CreateStronglyTypedExportFactoryOfT <T>(Export export) { return(new ExportFactory <T>( () => ExportServices.GetExportLifetimeContextFromExport <T>(export))); }
private static object CreateStronglyTypedExportFactoryOfTM <T, M>(Export export, ConstructorInfo constructor) { Func <Tuple <T, Action> > exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport <T>(export); return(constructor.Invoke(new object[] { exportLifetimeContextCreator, AttributedModelServices.GetMetadataView <M>(export.Metadata) })); }
private static object CreateStronglyTypedExportFactoryOfT <T>(Export export, ConstructorInfo constructor) { Func <Tuple <T, Action> > exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport <T>(export); return(constructor.Invoke(new object[] { exportLifetimeContextCreator })); }
private static object CreateStronglyTypedPartCreatorOfT <T>(Export export) { return(new PartCreator <T>( () => ExportServices.GetPartLifetimeContextFromExport <T>(export))); }