DataPortal.Fetch failed (Index was outside the bounds of the array.) WHY?
private static readonly PropertyInfo<EmployeeEC> EmployeeProperty = RegisterProperty<EmployeeEC>(p => p.Employee, RelationshipTypes.LazyLoad);
public EmployeeEC Employee
if ((!FieldManager.FieldExists(EmployeeProperty) || ReadProperty(EmployeeProperty) == null))
EmployeeEC.GetEmployee(CompanyGroupID,EmployeeID, (o, e) =>
if (e.Error != null)
Employee = e.Object; // EXECUTE THE ERROR HERE AFTER SECTIONB
Employee.IsEditByAttendanceOfficer = true; //for viewModel navigation
// Employee = DataPortal.Fetch<EmployeeEC>().Child;
SECTION B: //THIS WORK
public static void GetEmployee(int CompanyGroupID, int EmployeeID, EventHandler<DataPortalResult<EmployeeEC>> callback)
var dp = new DataPortal<EmployeeEC>();
dp.FetchCompleted += callback;
dp.BeginFetch(CompanyGroupID, EmployeeID); //CALL SECTIONC
SECTION C: //THIS NEVER EXCECUTE
private void DataPortal_Fetch(int pCompanyGroupID, int pEmployeeID)
have child EmployeeEC
this EmployeeEC is null set at start to work for lazyload, that works fine, but when it execute the server it throws this error.
DataPortal_Fetch() can only have one parameter - the criteria value.
The overload of BeginFetch() you are calling is this one:
public void BeginFetch(object criteria, object userState)
Your second parameter is being used as userState, which is not passed through the data portal to the server. User state is maintained in memory on the client and is provided to the callback handler - it is a standard .NET technique for passing "out of band" data from the start of an async call to the handler of the async result.
Copyright (c) Marimer LLC