Esempio n. 1
0
        public static T GetProviderOrThrow <T>()
        {
            T provider = InterfaceManager.GetInstancesOfType <T>().FirstOrDefault();

            if (provider == null)
            {
                throw new ProviderNotFoundException($"A provider for type {typeof(T).FullName} was not found");
            }

            return(provider);
        }
Esempio n. 2
0
        private IObjectImportProviderAsync GetAsyncProviderForType(SchemaType type)
        {
            foreach (IObjectImportProviderAsync provider in InterfaceManager.GetInstancesOfType <IObjectImportProviderAsync>())
            {
                if (provider.CanImport(type))
                {
                    return(provider);
                }
            }

            return(null);
        }
Esempio n. 3
0
        private IObjectImportProvider GetProviderForType(SchemaType type)
        {
            foreach (IObjectImportProvider provider in InterfaceManager.GetInstancesOfType <IObjectImportProvider>())
            {
                if (provider.CanImport(type))
                {
                    return(provider);
                }
            }

            throw new InvalidOperationException($"An import provider for the type '{type.Name}' could not be found");
        }
Esempio n. 4
0
 public static T GetProviderOrDefault <T>()
 {
     return(InterfaceManager.GetInstancesOfType <T>().FirstOrDefault());
 }