private string GetNameWithPrefixInBracketsIfAny(string name)
        {
            if (string.IsNullOrWhiteSpace(TablePrefix))
            {
                return(name);
            }

            return(name + "(" + TablePrefix.Trim('_') + ")");
        }
Exemplo n.º 2
0
 public string TrimTablePerfix(string tableName)
 {
     string[] tablePrefixs = TablePrefix.ToLower().Split(',');
     for (int i = 0; i < tablePrefixs.Length; i++)
     {
         string tablePrefix = tablePrefixs[i];
         if (tableName.ToLower().StartsWith(tablePrefix))
         {
             return(tableName.Substring(tablePrefix.Length));
         }
     }
     return(tableName);
 }
Exemplo n.º 3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Dataset.Length != 0)
            {
                hash ^= Dataset.GetHashCode();
            }
            if (TablePrefix.Length != 0)
            {
                hash ^= TablePrefix.GetHashCode();
            }
            if (ShardCount != 0L)
            {
                hash ^= ShardCount.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 4
0
 public void Check()
 {
     if (string.IsNullOrWhiteSpace(Connection))
     {
         throw new ArgumentNullException(nameof(Connection));
     }
     if (string.IsNullOrWhiteSpace(BaseNameSpace))
     {
         throw new ArgumentNullException(nameof(BaseNameSpace));
     }
     if (string.IsNullOrWhiteSpace(TargetFramwork))
     {
         throw new ArgumentNullException(nameof(TargetFramwork));
     }
     if (Schema != null && Schema.IndexOfAny(new char[] { '/', '*', '-' }) >= 0)
     {
         throw new NotSupportedException();
     }
     if (TablePrefix != null && TablePrefix.IndexOfAny(new char[] { '/', '*', '-' }) >= 0)
     {
         throw new NotSupportedException();
     }
     if (IgnorePrefix != null && IgnorePrefix.IndexOfAny(new char[] { '/', '*', '-' }) >= 0)
     {
         throw new NotSupportedException();
     }
     if (DatabaseType == "Npgsql")
     {
         if (string.IsNullOrWhiteSpace(Schema))
         {
             throw new ArgumentNullException(nameof(Schema));
         }
         if (Schema.IndexOfAny(new char[] { '/', '*', '-' }) >= 0)
         {
             throw new NotSupportedException();
         }
     }
 }