示例#1
0
        private ObjectTypeList AddStruct <TType>() where TType : struct
        {
            var type = typeof(TType);
            var id   = _counter++;

            _list.Add(new object[] { id,
                                     type.FullName,
                                     type.Namespace,
                                     "BCL",
                                     true,
                                     GetAlias <TType>(),
                                     0, 0 });
            _ids.Add(type, id);

            type = typeof(Nullable <TType>);
            FullTypeNameInfo ft = FullTypeNameInfo.Parse(type.FullName);

            id = _counter++;
            _list.Add(new object[] { id,
                                     ft.ToString(false, true),
                                     ft.Namespace,
                                     "BCL",
                                     true,
                                     GetAlias <TType?>(),
                                     0, 0 });
            _ids.Add(type, id);
            return(this);
        }
示例#2
0
        public void ParseGenericsWithManyArgs()
        {
            FullTypeNameInfo actual = FullTypeNameInfo.Parse(typeof(Dictionary <string, int>).FullName);

            actual.Name.Should().Be("Dictionary");
            actual.Namespace.Should().Be("System.Collections.Generic");
            actual.IsGeneric.Should().BeTrue();
            actual.GenericArguments.First().Name.Should().Be("String");
            actual.GenericArguments.First().Namespace.Should().Be("System");
            actual.GenericArguments.Last().Name.Should().Be("Int32");
            actual.GenericArguments.Last().Namespace.Should().Be("System");
        }
示例#3
0
 public ControllerAction(string name,
                         IEnumerable <Argument> requestArguments,
                         string responseType,
                         HttpVerb verb,
                         bool isResponseCollection,
                         string route,
                         Type handlerGenericInterfaceType,
                         Type handlerRequestType,
                         Type handlerReturnType)
 {
     Name                        = name;
     RequestArguments            = new ArgumentCollection(requestArguments);
     ResponseType                = responseType;
     Verb                        = verb;
     IsResponseCollection        = isResponseCollection;
     Route                       = route;
     HandlerGenericInterfaceType = handlerGenericInterfaceType;
     HandlerRequestType          = handlerRequestType;
     HandlerReturnType           = handlerReturnType;
     _handlerInterfaceInfo       = new Lazy <FullTypeNameInfo>(() => FullTypeNameInfo.Parse(HandlerGenericInterfaceType.FullName));
 }