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


C# Type.IsConcrete方法代码示例

本文整理汇总了C#中System.Type.IsConcrete方法的典型用法代码示例。如果您正苦于以下问题:C# Type.IsConcrete方法的具体用法?C# Type.IsConcrete怎么用?C# Type.IsConcrete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Type的用法示例。


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

示例1: Process

            public void Process(Type type, Registry registry)
            {
                // Only work on concrete types
                if (!type.IsConcrete() || type.IsGenericType) return;

                // Register against all the interfaces implemented
                // by this concrete class
                type.GetInterfaces().Each(@interface => { registry.For(@interface).Use(type); });
            }
开发者ID:RANENTONG,项目名称:structuremap,代码行数:9,代码来源:custom_registration_convention.cs

示例2: To

        public IBindingScope To(Type concreteType)
        {
            Assert.IsNotNull(concreteType);
            Assert.IsTrue(concreteType.IsConcrete());
            Assert.IsTrue(concreteType.Is(ContractType));

            return ToMethod(c => c.Container.Instantiator
                .Instantiate(new InjectionContext { Container = c.Container, DeclaringType = concreteType }));
        }
开发者ID:Magicolo,项目名称:PseudoFramework,代码行数:9,代码来源:BindingContract.cs

示例3: GetServiceRoutes

		public IEnumerable<Route> GetServiceRoutes(Type serviceType)
		{
			if (!serviceType.IsConcrete())
				throw new ArgumentException("Type " + serviceType + " must be a concrete type", "serviceType");

			return MethodsToRoutes(
				this.GetServiceMethodsFrom(serviceType)
					.Where(x => !x.IsShadowed(serviceType))
					.Select(x => x.IsVirtual? x.GetBaseDefinition(): x));
		}
开发者ID:serenata-evaldas,项目名称:Nancy.ServiceRouting,代码行数:10,代码来源:RouteAttributeServiceRouteResolver.cs

示例4: GetInterfaceType

        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            if (!type.IsConcrete() || !type.CanBeCreated())
                return;

            Type interfaceType = GetInterfaceType(type);

            if (interfaceType != null)
                registry.Register(interfaceType, type);
        }
开发者ID:mberubenet,项目名称:UnityConfiguration,代码行数:10,代码来源:FirstInterfaceConvention.cs

示例5: Process

        public void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete()) return;

            var baseType = type.BaseType;
            if (baseType != null && baseType.IsGenericType && baseType.GetGenericTypeDefinition() == m_mapType)
            {
                registry.AddType(baseType, type);
            }
        }
开发者ID:aqueduct,项目名称:Aqueduct.SitecoreLib,代码行数:10,代码来源:MapConventionScanner.cs

示例6: Process

        public void Process(Type type, Registry registry)
        {
            // Only work on concrete types
            if (!type.IsConcrete() || type.IsGenericType) return;

            // Register against all the interfaces implemented
            // by this concrete class
            type.GetInterfaces()
                .Where(@interface => @interface.Name == string.Format("I{0}", type.Name))
                .ForEach(@interface => registry.For(@interface).Use(type).Singleton());
        }
开发者ID:TonyDoumanis,项目名称:Financials,代码行数:11,代码来源:InterfaceConventions.cs

示例7: Process

        public override void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete() || !type.CanBeCreated()) return;

            Type interfaceType = type.AllInterfaces().FirstOrDefault();
            if (interfaceType != null)
            {
                registry.AddType(interfaceType, type);
                ConfigureFamily(registry.For(interfaceType));
            }
        }
开发者ID:satish860,项目名称:StructureMap3,代码行数:11,代码来源:FirstInterfaceConvention.cs

示例8: Process

        public override void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete()) return;

            var pluginType = FindPluginType(type);
            if (pluginType != null && type.HasConstructors())
            {
                registry.AddType(pluginType, type);
                ConfigureFamily(registry.For(pluginType));
            }
        }
开发者ID:joshilewis,项目名称:structuremap,代码行数:11,代码来源:DefaultConventionScanner.cs

示例9: Process

        public override void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete() || !type.CanBeCreated()) return;

            Type interfaceType = type.AllInterfaces().FirstOrDefault();
            if (interfaceType != null)
            {
                Debug.WriteLine("Plugging {0} into {1}".ToFormat(type.Name, interfaceType.Name));
                registry.AddType(interfaceType, type);
                ConfigureFamily(registry.For(interfaceType));
            }
        }
开发者ID:hp4711,项目名称:structuremap,代码行数:12,代码来源:FirstInterfaceConvention.cs

示例10: Bind

        public object Bind(Type type, IBindingContext context)
        {
            var entity = context.ValueAs(type, "Id");

            if (entity != null) return entity;

            if (type.IsConcrete())
            {
                return Activator.CreateInstance(type);
            }

            return null;
        }
开发者ID:pjdennis,项目名称:fubumvc,代码行数:13,代码来源:EntityModelBinder.cs

示例11: Process

        public void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete())
                return;
            
            if (!typeof(IHelpContext).IsAssignableFrom(type))
                return;

            var name = type.GetCustomAttributes(false).OfType<InstanceNameAttribute>().Select(x => x.Name).FirstOrDefault();
            if (string.IsNullOrEmpty(name))
                return;
            registry.For(typeof(IHelpContext)).Use(type).Named(name.ToLowerInvariant());
        }
开发者ID:kipwilliams,项目名称:Find.Me,代码行数:13,代码来源:HelperResponseRegistrationConvention.cs

示例12: Process

        public override void Process(Type type, Registry registry)
        {
            if (!type.IsConcrete())
                return;
            
            var pluginType = FindPluginType(type);
            if (pluginType == null || !Constructor.HasConstructors(type))
                return;

            registry.For(pluginType)
                .EnrichWith(z => DynamicProxy.CreateInterfaceProxyWithTarget(pluginType, z, _aspects))
                .Use(type);
        }
开发者ID:toddmeinershagen,项目名称:Demo.Aop,代码行数:13,代码来源:DefaultConventionScannerWithAspects.cs

示例13: Process

        public void Process(Type type, Registry registry)
        {
            // Only work on concrete types
            if (!type.IsConcrete() || type.IsGenericType) return;

            // Add against all the interfaces implemented
            // by this concrete class
            type.GetInterfaces()
                .Where(@interface => @interface.Name == $"I{type.Name}" )
                .ForEach(@interface => registry.For(@interface).Use(type).Singleton());

            if (type.Name.EndsWith("Job"))
                registry.For(type).Singleton();
        }
开发者ID:RomanBlyshchyk,项目名称:TailBlazer,代码行数:14,代码来源:AppConventions.cs

示例14: ConverterFor

        public Func<string, object> ConverterFor(Type type)
        {
            if (!type.IsConcrete()) {
                return null;
            }
            var constructor = type.GetConstructor (new [] { typeof(string) });
            if (constructor == null) {
                return null;
            }

            var param = Expression.Parameter (typeof(string), "arg");
            var body = Expression.New (constructor, param);

            return Expression.Lambda<Func<string, object>> (body, param).Compile();
        }
开发者ID:JasperFx,项目名称:baseline,代码行数:15,代码来源:StringConverterProvider.cs

示例15: Process

        public override void Process(Type type, Registry registry)
        {
            var interfaceTypes = type.FindInterfacesThatClose(_openType);
            if (!interfaceTypes.Any()) return;

            if (type.IsConcrete())
            {
                _concretions.Add(type);
            }

            foreach (var interfaceType in interfaceTypes)
            {
                _interfaces.Add(interfaceType);
            }
        }
开发者ID:flq,项目名称:structuremap,代码行数:15,代码来源:GenericConnectionScanner.cs


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