public static string SerializeType(object obj, ICriteria filterCriteria)
        {
            if (obj.GetType().IsArray)
            {
                return(GetElements(obj, filterCriteria));
            }
            else
            {
                string objName = obj.GetType().Name;

                string    critName         = filterCriteria.GetType().Name;
                string    searchDictionary = objName + critName + suffix;
                ICriteria contained;
                if (serializedObject.TryGetValue(searchDictionary, out contained))
                {
                    return(contained.Execute(obj));
                }
                Jsonfier.criteria = filterCriteria;
                ICriteria newObjSerialized = EmmiterUtils.CodeEmmiter(obj, objName, critName, filterCriteria);//We pass the strings to avoid using reflection again

                serializedObject.Add(searchDictionary, newObjSerialized);

                return(newObjSerialized.Execute(obj));
            }
        }
Пример #2
0
        private static string ProcessObject(object src, ICriteria crit)
        {
            int objHash = src.GetHashCode();

            if (!list.Contains(objHash))
            {
                list.AddFirst(objHash);
            }
            else
            {
                return("\"null\"");
            }
            return(crit.Execute(src));
        }
 public IQueryable <TEntity> Match(ICriteria <TEntity> criteria, bool readOnly = true)
 {
     return(criteria.Execute(_dataContext.Set <TEntity>()));
 }