Hi guys, I've got a problem.
Is it possible to have parametrized DataPortal.Fetch() method for editable root collection? (BusinessListBase<Roles, Role>).
For example (I'll take an example like in ProjectTracker), in RolesEdit WinPart of PTWin in ProjectTracker we have:
private void RolesEdit_Load(object sender, EventArgs e)
{
try
{
_roles = Roles.GetRoles();
}
but i want to be able to have an overload method of GetRoles() which will have (in my case) an integer parameter. Something like:
_roles = Roles.GetRoles(someIntParameter);
You could do this by having the following code (assuming version 3.8+), I believe the singleCriteria objects have changed in the latest versions not to require the first generic anymore.
Public Shared Function GetRoles(ByVal SomeIntValue as Integer) as Roles
Return DataPortal.Fetch(Of Roles)(New SingleCriteria(Of Roles, Integer)(SomeIntValue))
End Function
Private Sub DataPortal_Fetch(ByVal criteria as SingleCriteria(Of Roles, Integer))
'Use the criteria.Value property to access the integer value
End Sub
If you require more than one paramater then you need to create your own criteria class, inheriting from CriteriaBase and use that to populate and access the parameters both in the shared function and DataPortal_Fetch.
Thanks a lot mate.
it works just as it should :)
Copyright (c) Marimer LLC