Ejemplo n.º 1
0
        public static Definition CreateDefinition(ModelInfo.SearchParamDefinition paramdef)
        {
            Definition definition = new Definition();

            definition.Argument    = ArgumentFactory.Create(paramdef.Type);
            definition.Resource    = paramdef.Resource;
            definition.ParamName   = paramdef.Name;
            definition.Query       = new ElementQuery(paramdef.Path);
            definition.ParamType   = paramdef.Type;
            definition.Description = paramdef.Description;
            return(definition);
        }
Ejemplo n.º 2
0
        public Argument GuessArgument(string field)
        {
            var query =
                from d in definitions
                where (d.ParamName == field)
                group d by d.ParamType into pgroup
                let count = pgroup.Count()
                            orderby count descending
                            select new { ParamType = pgroup.Key, Count = count };

            //for testing:
            var pg = query.ToList();

            Argument argument = (query.Count() > 0) ? ArgumentFactory.Create(query.First().ParamType) : null;

            return(argument);
        }