DBHelper StripCommentsFromQuery Method CleanCode C# Libraries v1.2.03 API
Strips comments from a SQL query.

Namespace: CleanCode.Data
Assembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
Syntax

public string StripCommentsFromQuery(
	string query
)

Return Value

A cleaned up query.
Remarks

First, all block comments are stripped, delineated by BlockCommentStartMark and BlockCommentEndMark tokens. Next, all end-of-line comments are stripped, delineated by EndOfLineCommentMark and the end of its containing line. Finally, all multiple occurrences of line endings are replaced by a single newline character. Note, however, that this routine honors one special convention to allow you to force some end-of-line comments to remain. Simply use a double-occurrence of the EndOfLineCommentMark token on those comments.
See Also