Created
November 29, 2011 21:42
-
-
Save KevM/1406672 to your computer and use it in GitHub Desktop.
Clarify Extension Methods
This file contains hidden or 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
| public static class ClarifyGenericExtensions | |
| { | |
| public static ClarifyGeneric Filter(this ClarifyGeneric generic, Func<FilterExpression, Filter> filterFunction) | |
| { | |
| var filterExpression = new FilterExpression(); | |
| var filter = filterFunction(filterExpression); | |
| generic.Filter.AddFilter(filter); | |
| return generic; | |
| } | |
| public static ClarifyGeneric TraverseWithFields(this ClarifyGeneric generic, string relationName, params string[] fields) | |
| { | |
| if (fields == null || fields.Length < 1) | |
| fields = new[] {"objid"}; | |
| var childGeneric = generic.Traverse(relationName); | |
| childGeneric.DataFields.AddRange(fields); | |
| return childGeneric; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TraverseWithFields : Changes code like this
to this
or the equivalent