Esempio n. 1
0
        public override void Interpret(ColumnResolveContext context)
        {
            Regex regex = new Regex(@"<If_HasColumnType>(?<template>((?!</EndIf>).|\n)*)</EndIf>", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            Match match = regex.Match(context.Output);

            string template = match.Groups["template"].Value;

            string result = template.Replace(@"{Column_DataType}", context.Column.DbType);

            context.Output = regex.Replace(context.Output, result);
        }
        public override void Interpret(ColumnResolveContext context)
        {
            if (context == null || context.Column == null)
            {
                return;
            }

            Regex regex = new Regex(@"\{Column_Name\}", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            string text = context.Output;

            context.Output = regex.Replace(text, context.Column.Name);
        }
        public override void Interpret(ColumnResolveContext context)
        {
            Regex regex = new Regex(@"<If_IsRequired>(?<result>((?!</EndIf>).|\n)*)</EndIf>", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            Match match = regex.Match(context.Output);

            string result = match.Groups["result"].Value;

            //非必须字段(可为空),则忽略此属性
            if (context.Column.CanNullable)
            {
                result = "";
            }

            context.Output = regex.Replace(context.Output, result);
        }
        public override void Interpret(ColumnResolveContext context)
        {
            Regex regex = new Regex(@"<If_HasPrecision>(?<template>((?!</EndIf>).|\n)*)</EndIf>", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            Match match = regex.Match(context.Output);

            string template = match.Groups["template"].Value;

            PrecisionChecker  checker  = new PrecisionChecker();
            PrecisionReplacer replacer = new PrecisionReplacer();

            checker.SetSuccessor(replacer);

            string replaceStr = checker.Resolve(template, context.Column.DbType, context.Column.TotalBit, context.Column.DeicmalBit);

            context.Output = regex.Replace(context.Output, replaceStr);
        }
Esempio n. 5
0
        public override void Interpret(ColumnResolveContext context)
        {
            Regex regex = new Regex(@"<If_IsUniquePrimary>(?<template>((?!</EndIf>).|\n)*)</EndIf>", RegexOptions.IgnoreCase | RegexOptions.Compiled);

            Match match = regex.Match(context.Output);

            string template = match.Groups["template"].Value;

            UniquePrimaryChecker  checker  = new UniquePrimaryChecker();
            UniquePrimaryReplacer replacer = new UniquePrimaryReplacer();

            checker.SetSuccessor(replacer);

            string replaceStr = checker.Resolve(template, context.Column);

            context.Output = regex.Replace(context.Output, replaceStr);
        }