Ejemplo n.º 1
0
        private List <QueryBinding> GetQueryBindings(SimpleType qType, Expression inner)
        {
            var result = new List <QueryBinding>();

            //Create a binding which wraps the queryable type.
            var queryBinding = new QueryBinding {
                Value = qType, TranslatedExpression = inner
            };

            result.Add(queryBinding);

            //If this is a complex type, we need to recursively go through the fields.
            //eg of complex type is: new { U = user, A = user.Account }
            //  We are trying to traverse U and A in the example above.
            var members = qType.GetAllMembers();

            if (members.Count > 0)
            {
                foreach (var kvp in members)
                {
                    result.AddRange(GetQueryBindings(kvp.Value, typeTranslationUtil.GetTranslatedMemberExpression(qType.Type, qType.GetMemberName(kvp.Key), inner)));
                }
            }

            return(result);
        }