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
public static class GuidIntConverter | |
{ | |
public static Guid ToGuid(int integer) | |
{ | |
return new GuidConverter(integer).Guid; | |
} | |
public static int ToInt(Guid guid) | |
{ | |
return new GuidConverter(guid).Integer; |
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
//x => x.fieldName.Contains(fieldValue) | |
public static IQueryable<T> FilterByValue<T>(this IQueryable<T> q, string fieldName, string fieldValue) | |
{ | |
try | |
{ | |
var param = Expression.Parameter(typeof(T), "p"); | |
var prop = Expression.Property(param, fieldName); | |
if (((PropertyInfo)prop.Member).PropertyType != typeof(string)) | |
return q; |