-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ZEXSM/bugfix/ampersands-in-string-values
Bugfix/ampersands in string values
- Loading branch information
Showing
8 changed files
with
154 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
public interface IODataFunction : IODataStringAndCollectionFunction, IODataDateFunction, IConvertFunction | ||
public interface IODataFunction : IODataStringAndCollectionFunction, IODataDateFunction, IConvertFunction, IReplaceFunction | ||
{ | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/OData.QueryBuilder/Conventions/Functions/IReplaceFunction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OData.QueryBuilder.Conventions.Functions | ||
{ | ||
public interface IReplaceFunction | ||
{ | ||
string ReplaceCharacters(string value, IDictionary<string, string> keyValuePairs); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
namespace OData.QueryBuilder.Extensions | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace OData.QueryBuilder.Extensions | ||
{ | ||
internal static class StringExtensions | ||
{ | ||
public static bool IsNullOrQuotes(this string value) => | ||
string.IsNullOrEmpty(value) || value == "null" || value == "''"; | ||
|
||
public static string ReplaceWithStringBuilder(this string value, IDictionary<string, string> keyValuePairs) | ||
{ | ||
var stringBuilder = new StringBuilder(value); | ||
|
||
foreach (var keyValuePair in keyValuePairs) | ||
{ | ||
stringBuilder.Replace(keyValuePair.Key, keyValuePair.Value); | ||
} | ||
|
||
return stringBuilder.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters