当前位置: 首页>>代码示例>>C#>>正文


C# ITypeProvider类代码示例

本文整理汇总了C#中ITypeProvider的典型用法代码示例。如果您正苦于以下问题:C# ITypeProvider类的具体用法?C# ITypeProvider怎么用?C# ITypeProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITypeProvider类属于命名空间,在下文中一共展示了ITypeProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Config

        private void Config(IProfileRegistry config, ITypeProvider typeProvider)
        {
            var largeMessageBodyTempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Guid.NewGuid().ToString());

            config.For<ILogger>()
                .Use<ConsoleLogger>()
                .Singleton();

            config.For<ILargeMessageBodyStore>()
                .Use(c => new FileSystemStorageBuilder().Configure()
                    .WithStorageDirectory(largeMessageBodyTempPath)
                    .WithLogger(c.GetInstance<ILogger>())
                    .Build())
                .Singleton();

            config.For<IBus>()
                .Use(c => new BusBuilder().Configure()
                    .WithNames("IntegrationTestHarness", Environment.MachineName)
                    .WithConnectionString(@"Endpoint=sb://shouldnotexist.example.com/;SharedAccessKeyName=IntegrationTestHarness;SharedAccessKey=borkborkbork=")
                    .WithLargeMessageStorage(sc => sc.WithLargeMessageBodyStore(c.GetInstance<ILargeMessageBodyStore>())
                        .WithMaxSmallMessageSize(50 * 1024)
                        .WithMaxLargeMessageSize(1024 * 1024))
                    .WithTypesFrom(typeProvider)
                    .WithDefaultTimeout(TimeSpan.FromSeconds(10))
                    .WithLogger(c.GetInstance<ILogger>())
                    .Build())
                .Singleton();
        }
开发者ID:AtmosphereMessaging,项目名称:Cumulus,代码行数:28,代码来源:WhenBuildingABusWithStructuremapAndFileSystemMessageStorage.cs

示例2: GetContextType

        internal static Type GetContextType(ITypeProvider typeProvider, Activity currentActivity)
        {
            Type contextType = null;
            string className = String.Empty;
            Activity rootActivity = null;

            if (Helpers.IsActivityLocked(currentActivity))
            {
                rootActivity = Helpers.GetDeclaringActivity(currentActivity);
            }
            else
            {
                rootActivity = Helpers.GetRootActivity(currentActivity);
            }

            if (rootActivity != null)
            {
                className = rootActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
                if (!String.IsNullOrEmpty(className))
                    contextType = typeProvider.GetType(className, false);

                if (contextType == null)
                    contextType = typeProvider.GetType(rootActivity.GetType().FullName);

                // If all else fails (likely, we don't have a type provider), it's the root activity type.
                if (contextType == null)
                    contextType = rootActivity.GetType();
            }

            return contextType;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:Helpers.cs

示例3: Create

 public IDependencyResolver Create(ITypeProvider typeProvider)
 {
     var kernel = new StandardKernel();
     kernel.Components.Remove<IMissingBindingResolver, SelfBindingResolver>();
     kernel.RegisterNimbus(typeProvider);
     return kernel.Get<IDependencyResolver>();
 }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:7,代码来源:NinjectDependencyResolverFactory.cs

示例4: CreateBus

        private static Bus CreateBus(IWindsorContainer container, ITypeProvider typeProvider)
        {
            var configRetriever = container.Resolve<IGetEnvironmentConfiguration>();
            
            try
            {
                // Get the Azure Service Bus connection string, app name, and unique name for this running instance
                string connectionString = configRetriever.GetSetting(AzureServiceBusConnectionStringKey);
                string appName = configRetriever.AppName;
                string uniqueName = configRetriever.UniqueInstanceId;

                Bus bus = new BusBuilder().Configure()
                                          .WithConnectionString(connectionString)
                                          .WithNames(appName, uniqueName)
                                          .WithJsonSerializer()
                                          .WithWindsorDefaults(container)
                                          .WithTypesFrom(typeProvider)
                                          .Build();
                bus.Start();
                return bus;
            }
            finally
            {
                container.Release(configRetriever);
            }
        }
开发者ID:johnbabb,项目名称:killrvideo-csharp,代码行数:26,代码来源:NimbusWindsorInstaller.cs

示例5: RegisterNimbus

        public static ContainerBuilder RegisterNimbus(this ContainerBuilder builder, ITypeProvider typeProvider)
        {
            builder.RegisterTypes(typeProvider.AllHandlerTypes())
                   .AsImplementedInterfaces()
                   .InstancePerLifetimeScope();

            builder.RegisterType<AutofacMulticastEventHandlerFactory>()
                   .AsImplementedInterfaces()
                   .SingleInstance();

            builder.RegisterType<AutofacCompetingEventHandlerFactory>()
                   .AsImplementedInterfaces()
                   .SingleInstance();

            builder.RegisterType<AutofacCommandHandlerFactory>()
                   .AsImplementedInterfaces()
                   .SingleInstance();

            builder.RegisterType<AutofacRequestHandlerFactory>()
                   .AsImplementedInterfaces()
                   .SingleInstance();

            builder.RegisterType<AutofacMulticastRequestHandlerFactory>()
                   .AsImplementedInterfaces()
                   .SingleInstance();

            return builder;
        }
开发者ID:shingi,项目名称:Nimbus,代码行数:28,代码来源:NimbusContainerBuilderExtensions.cs

示例6: RuleValidation

 public RuleValidation(Activity activity, ITypeProvider typeProvider, bool checkStaticType)
 {
     this.errors = new ValidationErrorCollection();
     this.typesUsed = new Dictionary<string, Type>(0x10);
     this.activeParentNodes = new Stack<CodeExpression>();
     this.expressionInfoMap = new Dictionary<CodeExpression, RuleExpressionInfo>();
     this.typeRefMap = new Dictionary<CodeTypeReference, Type>();
     if (activity == null)
     {
         throw new ArgumentNullException("activity");
     }
     if (typeProvider == null)
     {
         throw new ArgumentNullException("typeProvider");
     }
     this.thisType = ConditionHelper.GetContextType(typeProvider, activity);
     this.typeProvider = typeProvider;
     this.checkStaticType = checkStaticType;
     if (checkStaticType)
     {
         this.authorizedTypes = WorkflowCompilationContext.Current.GetAuthorizedTypes();
         this.typesUsedAuthorized = new Dictionary<string, Type>();
         this.typesUsedAuthorized.Add(voidTypeName, voidType);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:RuleValidation.cs

示例7: BuildContainer

        private void BuildContainer(ITypeProvider typeProvider)
        {
            if (_container != null) throw new InvalidOperationException("This factory is only supposed to be used to construct one test subject.");

            _container = new WindsorContainer();
            _container.RegisterNimbus(typeProvider);
        }
开发者ID:mneelakanta,项目名称:Nimbus,代码行数:7,代码来源:WindsorDependencyResolverFactory.cs

示例8: AzureQueueManager

        public AzureQueueManager(Func<NamespaceManager> namespaceManager,
                                 Func<MessagingFactory> messagingFactory,
                                 AutoDeleteOnIdleSetting autoDeleteOnIdle,
                                 DefaultMessageTimeToLiveSetting defaultMessageTimeToLive,
                                 DefaultTimeoutSetting defaultTimeout,
                                 EnableDeadLetteringOnMessageExpirationSetting enableDeadLetteringOnMessageExpiration,
                                 GlobalPrefixSetting globalPrefix,
                                 MaxDeliveryAttemptSetting maxDeliveryAttempts,
                                 IPathFactory pathFactory,
                                 IRetry retry,
                                 ISqlFilterExpressionGenerator sqlFilterExpressionGenerator,
                                 ITypeProvider typeProvider)
        {
            _namespaceManager = namespaceManager;
            _messagingFactory = messagingFactory;
            _maxDeliveryAttempts = maxDeliveryAttempts;
            _retry = retry;
            _typeProvider = typeProvider;
            _defaultMessageTimeToLive = defaultMessageTimeToLive;
            _autoDeleteOnIdle = autoDeleteOnIdle;
            _defaultTimeout = defaultTimeout;
            _enableDeadLetteringOnMessageExpiration = enableDeadLetteringOnMessageExpiration;
            _globalPrefix = globalPrefix;
            _sqlFilterExpressionGenerator = sqlFilterExpressionGenerator;
            _pathFactory = pathFactory;

            _knownTopics = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingTopics);
            _knownSubscriptions = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingSubscriptions);
            _knownQueues = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingQueues);
        }
开发者ID:NimbusAPI,项目名称:Nimbus,代码行数:30,代码来源:AzureQueueManager.cs

示例9: RegisterNimbus

        public static ContainerBuilder RegisterNimbus(this ContainerBuilder builder, ITypeProvider typeProvider)
        {
            foreach (var handlerType in typeProvider.AllHandlerTypes())
            {
                var handlerInterfaceTypes = handlerType.GetInterfaces().Where(typeProvider.IsClosedGenericHandlerInterface);
                foreach (var interfaceType in handlerInterfaceTypes)
                {
                    builder.RegisterType(handlerType)
                           .Named(handlerType.FullName, interfaceType)
                           .InstancePerLifetimeScope();
                }
            }

            builder.RegisterSource(new ContravariantRegistrationSource());
            typeProvider.InterceptorTypes
                        .Do(t => builder.RegisterType(t)
                                        .AsSelf()
                                        .InstancePerLifetimeScope())
                        .Done();

            builder.RegisterInstance(typeProvider)
                   .AsImplementedInterfaces()
                   .SingleInstance();

            builder.RegisterType<AutofacDependencyResolver>()
                   .As<IDependencyResolver>()
                   .SingleInstance();

            return builder;
        }
开发者ID:Joshscorp,项目名称:Nimbus,代码行数:30,代码来源:NimbusContainerBuilderExtensions.cs

示例10: GetContextType

 internal static Type GetContextType(ITypeProvider typeProvider, Activity currentActivity)
 {
     Type type = null;
     string str = string.Empty;
     Activity declaringActivity = null;
     if (System.Workflow.Activities.Common.Helpers.IsActivityLocked(currentActivity))
     {
         declaringActivity = System.Workflow.Activities.Common.Helpers.GetDeclaringActivity(currentActivity);
     }
     else
     {
         declaringActivity = System.Workflow.Activities.Common.Helpers.GetRootActivity(currentActivity);
     }
     if (declaringActivity != null)
     {
         str = declaringActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
         if (!string.IsNullOrEmpty(str))
         {
             type = typeProvider.GetType(str, false);
         }
         if (type == null)
         {
             type = typeProvider.GetType(declaringActivity.GetType().FullName);
         }
         if (type == null)
         {
             type = declaringActivity.GetType();
         }
     }
     return type;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ConditionHelper.cs

示例11: RTTypeWrapper

 private RTTypeWrapper(ITypeProvider typeProvider, Type runtimeType, Type[] typeArgs)
 {
     this.memberMapping = new Hashtable();
     this.boundedTypes = new Hashtable(new TypeArrayComparer());
     if (runtimeType == null)
     {
         throw new ArgumentNullException("runtimeType");
     }
     if (runtimeType.Assembly == null)
     {
         throw new ArgumentException(SR.GetString("Error_InvalidArgumentValue"), "runtimeType");
     }
     this.typeProvider = typeProvider;
     this.runtimeType = runtimeType;
     if (!this.IsGenericTypeDefinition)
     {
         throw new ArgumentException(SR.GetString("Error_InvalidArgumentValue"), "runtimeType");
     }
     this.typeArgs = new Type[typeArgs.Length];
     for (int i = 0; i < typeArgs.Length; i++)
     {
         this.typeArgs[i] = typeArgs[i];
         if (this.typeArgs[i] == null)
         {
             throw new ArgumentException(SR.GetString("Error_InvalidArgumentValue"), "typeArgs");
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:RTTypeWrapper.cs

示例12: DoYourThingConfigurationConfigurator

        internal DoYourThingConfigurationConfigurator(ITypeProvider typeProvider, Action<IConfigurationSetting> registerAsSingleton)
        {
            _typeProvider = typeProvider;
            _registerAsSingleton = registerAsSingleton;

            _settingKeyConventions.AddRange(SettingKeyConventions.BuiltInConventions);
        }
开发者ID:uglybugger,项目名称:ConfigInjector,代码行数:7,代码来源:DoYourThingConfigurationConfigurator.cs

示例13: SettingsRegistrationService

        public SettingsRegistrationService(IConfigInjectorLogger logger,
                                           ITypeProvider typeProvider,
                                           ISettingKeyConvention[] settingKeyConventions,
                                           ISettingsReader settingsReader,
                                           ISettingsOverrider settingsOverrider,
                                           SettingValueConverter settingValueConverter,
                                           bool allowEntriesInWebConfigThatDoNotHaveSettingsClasses,
                                           Action<IConfigurationSetting> registerAsSingleton)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (typeProvider == null) throw new ArgumentNullException("typeProvider");
            if (settingKeyConventions == null) throw new ArgumentNullException("settingKeyConventions");
            if (settingsReader == null) throw new ArgumentNullException("settingsReader");
            if (settingsOverrider == null) throw new ArgumentNullException("settingsOverrider");
            if (settingValueConverter == null) throw new ArgumentNullException("settingValueConverter");
            if (registerAsSingleton == null) throw new ArgumentNullException("registerAsSingleton");

            _logger = logger;
            _typeProvider = typeProvider;
            _settingKeyConventions = settingKeyConventions;
            _settingsReader = settingsReader;
            _settingsOverrider = settingsOverrider;
            _settingValueConverter = settingValueConverter;
            _allowEntriesInWebConfigThatDoNotHaveSettingsClasses = allowEntriesInWebConfigThatDoNotHaveSettingsClasses;
            _registerAsSingleton = registerAsSingleton;
        }
开发者ID:uglybugger,项目名称:ConfigInjector,代码行数:26,代码来源:SettingsRegistrationService.cs

示例14: SourcesWindow

        public SourcesWindow(ITypeProvider typeProvider, ISourceNavigator sourceNavigator,
			ISourcesProvider sourcesProvider
)
        {
            this.typeProvider = typeProvider;
            this.sourceNavigator = sourceNavigator;
            this.sourcesProvider = sourcesProvider;
        }
开发者ID:shana,项目名称:debugger,代码行数:8,代码来源:SourcesWindow.cs

示例15: RegisterNimbus

        public static IBindingRoot RegisterNimbus(this IBindingRoot kernel, ITypeProvider typeProvider)
        {
            kernel.Bind<IDependencyResolver>().To<NinjectDependencyResolver>().InSingletonScope();
            kernel.Bind<ITypeProvider>().ToConstant(typeProvider).InSingletonScope();

            BindAllHandlerInterfaces(kernel, typeProvider);

            return kernel;
        }
开发者ID:joshka,项目名称:Nimbus,代码行数:9,代码来源:NimbusNinjectKernelExtensions.cs


注:本文中的ITypeProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。