123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- namespace Ant.ORM
- {
- public static class StringExtension
- {
-
-
-
-
-
-
-
-
-
- private static string SqlAppendComment(this string sql,
- string author, string forUse, string fileName, string funName, string projectname)
- {
- if (author == null)
- {
- throw new ArgumentNullException("author参数为null或空字符串");
- }
- if (string.IsNullOrEmpty(forUse))
- {
- throw new ArgumentNullException("forUse参数为null或空字符串");
- }
- if (string.IsNullOrEmpty(fileName))
- {
- throw new ArgumentNullException("fileName参数为null或空字符串");
- }
- if (string.IsNullOrEmpty(funName))
- {
- throw new ArgumentNullException("funName参数为null或空字符串");
- }
- return
- string.Format(
- @"{0}
- --Flat:{5}/Author:{1}/For:{2}/File:{3}/Fun:{4}",
- sql,
- author,
- forUse,
- fileName,
- funName,
- projectname);
- }
-
-
-
-
-
-
-
-
-
-
-
-
- public static string AppendComment(this string sql,
- SqlComment comment)
- {
- if (!SqlComment.IsTest)
- {
- return sql.SqlAppendComment(comment.Author, comment.ForUse, comment.FileName, comment.FunName,comment.ProjectName);
- }
- return sql;
- }
-
-
-
- public class SqlComment
- {
-
-
-
- public string Author { get; set; }
-
-
-
- public string ForUse { get; set; }
-
-
-
- public string FileName { get; set; }
-
-
-
- public string FunName { get; set; }
-
-
-
- public static bool IsTest { get; set; }
-
-
-
- public string ProjectName { get; set; }
- }
- }
- }
|