コード例 #1
0
ファイル: ApplyBinder.cs プロジェクト: sivethe/odata.net
        private static void RegisterProperty(IList <GroupByPropertyNode> properties, Stack <SingleValueNode> propertyStack)
        {
            var    property     = propertyStack.Pop();
            string propertyName = GetNodePropertyName(property);

            if (propertyStack.Count != 0)
            {
                // Not at the leaf, let's add to the container.
                var containerProperty = properties.FirstOrDefault(p => p.Name == propertyName);
                if (containerProperty == null)
                {
                    // We do not have container yet. Create it.
                    containerProperty = new GroupByPropertyNode(propertyName, null);
                    properties.Add(containerProperty);
                }

                RegisterProperty(containerProperty.ChildTransformations, propertyStack);
            }
            else
            {
                // It's the leaf just add.
                var accessNode = property as SingleValuePropertyAccessNode;
                properties.Add(new GroupByPropertyNode(propertyName, property, accessNode.TypeReference));
            }
        }
コード例 #2
0
ファイル: ApplyBinder.cs プロジェクト: TomDu/odata.net
        private static void RegisterProperty(IList<GroupByPropertyNode> properties, Stack<SingleValueNode> propertyStack)
        {
            var property = propertyStack.Pop();
            string propertyName = GetNodePropertyName(property);

            if (propertyStack.Count != 0)
            {
                // Not at the leaf, let's add to the container.
                var containerProperty = properties.FirstOrDefault(p => p.Name == propertyName);
                if (containerProperty == null)
                {
                    // We do not have container yet. Create it.
                    containerProperty = new GroupByPropertyNode(propertyName, null);
                    properties.Add(containerProperty);
                }

                RegisterProperty(containerProperty.ChildTransformations, propertyStack);
            }
            else
            {
                // It's the leaf just add.
                var accessNode = property as SingleValuePropertyAccessNode;
                properties.Add(new GroupByPropertyNode(propertyName, property, accessNode.TypeReference));
            }
        }