/// <summary> /// Instantiates a new <see cref="Table"/>. /// </summary> public Table(string tableName, string schema, bool sanitize) { Guard.AgainstNullOrEmpty(tableName, nameof(tableName)); Guard.AgainstNullOrEmpty(schema, nameof(schema)); TableName = tableName; Schema = schema; if (sanitize) { TableName = SqlSanitizer.Sanitize(TableName); Schema = SqlSanitizer.Sanitize(Schema); } FullTableName = $"{Schema}.{TableName}"; }
public void Table_name_and_schema_should_be_quoted() { Assert.Equal("[MyEndpoint]", SqlSanitizer.Sanitize("MyEndpoint")); Assert.Equal("[MyEndpoint]]; SOME OTHER SQL;--]", SqlSanitizer.Sanitize("MyEndpoint]; SOME OTHER SQL;--")); }