Hello,
I need to create retrieveresponse without entityid. but I pass another id in MyRow. I can't retrieve the value in my project.
For Example, MyRow is Investigation, this entityId is InvestigetionId,
And my other id is AdmissionId.
You might call the List method instead and take the first record.
For example,
var entity = new SomeRepository().List(connection, new ListRequest
{
Criteria = new Criteria(nameof(SomeRow.AdmissionId)) == 5,
Take = 1
}).Entities.FirstOrDefault();
In repository.cs you can custom Retrieve/List... like you want, they have some methods that you can overwrite
here is list of methods
https://github.com/volkanceylan/Serenity/wiki/Serenity-Framework:-Repository-overridable-methods-and-calling-sequence
here is example it relates to List, not Retrieve but you can do something like that with Retrieve
private class MyListHandler : CustomListRequestHandle<MyRow> { }
public class CustomListRequestHandle<TRow> : ListRequestHandler<TRow> where TRow : Row, new()
{
protected override void ApplyFilters(SqlQuery query)
{
base.ApplyFilters(query);
if (Request is Common.MyBaseListRequest customRequest)
{
if (customRequest.EnableOnlyNextPreviousMode)
{
query.ApplySkipTakeAndCount(this.Request.Skip, this.Request.Take, this.Request.ExcludeTotalCount || DistinctFields != null);
// Setting CountRecords to false stops the count(*) query from running
query.CountRecords = false;
}
}
}
}
thanks
Most helpful comment
here is list of methods
https://github.com/volkanceylan/Serenity/wiki/Serenity-Framework:-Repository-overridable-methods-and-calling-sequence
here is example it relates to List, not Retrieve but you can do something like that with Retrieve