コード例 #1
0
        /// <summary>
        /// Extract IndexKey Definition from context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static MySqlKeyDefinition ExtractIndexKey(IndexDeclarationContext context)
        {
            if (context == null)
            {
                throw new ArgumentOutOfRangeException($"{nameof(context)} is null");
            }
            var simpleIndexDeclarationContext = context.GetChild <SimpleIndexDeclarationContext>();

            return(ExtractKeyDefinition(simpleIndexDeclarationContext));
        }
コード例 #2
0
        /// <summary>
        /// Listener for Index Index detection
        /// </summary>
        /// <remarks>
        /// override method <see cref="EnterIndexColumnNames"/> includes PK and secondary key and it not contains index name. Therefore let's drill down declaration.
        /// </remarks>
        /// <param name="context"></param>
        public override void EnterIndexDeclaration([NotNull] IndexDeclarationContext context)
        {
            base.EnterIndexDeclaration(context);

            // index (secondary key)
            var definition = MySqlKeyDefinition.ExtractIndexKey(context);

            TableDefinition.AddIndexKey(definition);

            // map IndexKey and existing Column reference
            definition.AddIndexKeyReferenceOnColumn(TableDefinition.Columns);
        }