當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。