I need to enhance a function of C# code. I am new to C# but I have strong java background.
My job is to write a new query, like JDBC, to get data from database.
In the method below, I didn't see any SQL query.
what does this line mean ? is this similar to Hibernate hql ?
from p in Session.Query<MyObject>() select p
Thanks
code:
public IPagingList<MyObject> ReadMyObjectItems(int start, int limit, IList<Filter> filters)
{
var criteria = Session.CreateCriteria<MyObject>();
if (limit != -1)
{
criteria.SetMaxResults(limit);
criteria.SetFirstResult(start);
}
if (filters != null)
{
foreach (var filter in filters)
{
criteria.Add(Restrictions.InsensitiveLike(filter.Field, "%" + filter.Value + "%"));
}
}
IList<MyObject> report = criteria.List<MyObject>();
int total = (from p in Session.Query<MyObject>() select p).Count();
var pagedResults = new PagingList<MyObject> { List = report, Total = total };
return pagedResults;
}