コード例 #1
0
        public static MetadataAttribute ToMetadataAttribute(this MetadataRoute route)
        {
            if (route.Verbs != null)
            {
                return(new MetadataAttribute
                {
                    Name = "Route",
                    Args = new List <MetadataPropertyType> {
                        new MetadataPropertyType {
                            Name = "Path", Type = "string", Value = route.Path
                        },
                        new MetadataPropertyType {
                            Name = "Verbs", Type = "string", Value = route.Verbs
                        },
                    },
                });
            }

            return(new MetadataAttribute
            {
                Name = "Route",
                ConstructorArgs = new List <MetadataPropertyType>
                {
                    new MetadataPropertyType {
                        Type = "string", Value = route.Path
                    },
                },
            });
        }
コード例 #2
0
        public static MetadataAttribute ToMetadataAttribute(this MetadataRoute route)
        {
            var attr = new MetadataAttribute
            {
                Name            = "Route",
                ConstructorArgs = new List <MetadataPropertyType>
                {
                    new MetadataPropertyType {
                        Type = "string", Value = route.Path
                    },
                },
            };

            if (route.Verbs != null)
            {
                attr.ConstructorArgs.Add(
                    new MetadataPropertyType {
                    Type = "string", Value = route.Verbs
                });
            }

            return(attr);
        }