-
Notifications
You must be signed in to change notification settings - Fork 14
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 #19 from arslanaybars/fpaganetto-support-guid-type
Fpaganetto support guid type pr
- Loading branch information
Showing
6 changed files
with
62 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Fop.Exceptions | ||
{ | ||
public class GuidDataTypeNotSupportedException : FopException | ||
{ | ||
|
||
public GuidDataTypeNotSupportedException(string message) : base(message) { } | ||
|
||
} | ||
} |
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ public enum FilterDataTypes : byte | |
Char, | ||
DateTime, | ||
Boolean, | ||
Enum | ||
Enum, | ||
Guid | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Fop.Exceptions; | ||
using Fop.Filter; | ||
|
||
namespace Fop.Strategies | ||
{ | ||
public class GuidTypeStrategy : IFilterDataTypeStrategy | ||
{ | ||
public string ConvertFilterToText(IFilter filter) | ||
{ | ||
switch (filter.Operator) | ||
{ | ||
case FilterOperators.Equal: | ||
return filter.Key + " == new Guid(\"" + filter.Value + "\")"; | ||
case FilterOperators.NotEqual: | ||
return filter.Key + " != new Guid(\"" + filter.Value + "\")"; | ||
case FilterOperators.Contains: | ||
case FilterOperators.NotContains: | ||
case FilterOperators.StartsWith: | ||
case FilterOperators.NotStartsWith: | ||
case FilterOperators.EndsWith: | ||
case FilterOperators.NotEndsWith: | ||
case FilterOperators.GreaterThan: | ||
case FilterOperators.GreaterOrEqualThan: | ||
case FilterOperators.LessThan: | ||
case FilterOperators.LessOrEqualThan: | ||
default: | ||
throw new GuidDataTypeNotSupportedException($"Guid filter does not support {filter.Operator}"); | ||
} | ||
} | ||
} | ||
} |