Пример #1
0
        public CommandDescription(Type commandType, bool includeDetails) : base(commandType.Name, commandType.Namespace)
        {
            EmptyModel = Activator.CreateInstance(commandType);

            var commandSchema = CommandSchemaGenerator.GenerateSchema(commandType);

            Schema = new SchemaObject(commandSchema, Name, Namespace);

            Links = new List <JsonLink>()
            {
                new JsonLink(string.Format("/api/commands/{0}/{1}/publish", Namespace, Name), "publication"),
            };

            if (includeDetails)
            {
                Links.Add(new JsonLink(string.Format("/api/commands/{0}/{1}", Namespace, Name), "details"));
            }
            else
            {
                Links.Add(new JsonLink("/api/commands/", "home"));
            }
        }