コード例 #1
0
        private void ExtractContractTypes()
        {
            var boundGenericContracts = ComponentContextUtils.FindContracts(_targetType)
                                        .Where(t => t.IsOpenGenericType());

            foreach (var boundGenericContract in boundGenericContracts)
            {
                var openContract = boundGenericContract.GetGenericTypeDefinition();
                _contractTypes.Add(openContract, boundGenericContract);
            }
        }
コード例 #2
0
        private void ExtractContractTypes()
        {
            var openContracts = ComponentContextUtils.FindContracts(_targetType)
                                .Where(t => t.ContainsGenericParameters && t.IsGenericType);

            foreach (var openContract in openContracts)
            {
                _contractTypes.Add(openContract.GetGenericTypeDefinition(), openContract);
            }

            if (_contractTypes.Count < 1)
            {
                throw new CompositionException("No open contracts found on the type " + _targetType.Name);
            }
        }
コード例 #3
0
 public IEnumerable <Type> GetContractTypes()
 {
     return(ComponentContextUtils.FindContracts(_componentInstance.GetType()));
 }
コード例 #4
0
 public IEnumerable <Type> GetContractTypes()
 {
     return(ComponentContextUtils.FindContracts(_targetType));
 }