Пример #1
0
            /// <summary>
            /// Cannot override the sealed method ExplicitIndex(IndexStatement node) in TSqlConcreteFragmentVisitor so working around that
            /// with this method that the create and alter overrides can call.
            /// </summary>
            /// <param name="node">IndexStatement node to change options on</param>
            private void IndexExplicitVisit(IndexStatement node)
            {
                // IndexOptions is not expected to be null, since it can't be overridden
                if (node.IndexOptions != null)
                {
                    // Remove existing values if we need to overwrite them
                    List <IndexOption> existingOptions = new List <IndexOption>(node.IndexOptions);
                    foreach (IndexOption option in existingOptions)
                    {
                        IndexOption updatedOption;
                        if (_optionKindToOptionMap.TryGetValue(option.OptionKind, out updatedOption))
                        {
                            node.IndexOptions.Remove(option);
                        }
                    }

                    // Add the new values
                    foreach (var option in _optionKindToOptionMap.Values)
                    {
                        node.IndexOptions.Add(option);
                    }
                }
            }
 public override void ExplicitVisit(IndexStatement fragment)
 {
     _fragments.Add(fragment);
 }
Пример #3
0
 public override void ExplicitVisit(IndexStatement node) { this.action(node); }
            /// <summary>
            /// Cannot override the sealed method ExplicitIndex(IndexStatement node) in TSqlConcreteFragmentVisitor so working around that
            /// with this method that the create and alter overrides can call.
            /// </summary>
            /// <param name="node">IndexStatement node to change options on</param>
            private void IndexExplicitVisit(IndexStatement node)
            {
                // IndexOptions is not expected to be null, since it can't be overridden
                if (node.IndexOptions != null)
                {

                    // Remove existing values if we need to overwrite them
                    List<IndexOption> existingOptions = new List<IndexOption>(node.IndexOptions);
                    foreach (IndexOption option in existingOptions)
                    {
                        IndexOption updatedOption;
                        if (_optionKindToOptionMap.TryGetValue(option.OptionKind, out updatedOption))
                        {
                            node.IndexOptions.Remove(option);
                        }
                    }

                    // Add the new values
                    foreach (var option in _optionKindToOptionMap.Values)
                    {
                        node.IndexOptions.Add(option);
                    }
                }
            }