All of the code which references the
ResourceManager
needs to run in-memory, not in the database.
Add an
.AsEnumerable()
call between the
.Where(...)
and the
.Select(...)
statements to force the projection to run in-memory:
var Query = DB1.view_items_history
.Where(u => u.stitems_ID == itemID && u.OpDate >= From && u.OpDate <= To)
.AsEnumerable()
.Select(s => new CLSItemsHistory
{
stitems_ID = s.stitems_ID,
stitems_Status = s.stitems_Status,
stitems_Name = s.stitems_Name,
stitems_Type = s.stitems_Type,
stitems_Type_name = s.stitems_Type == 0 ? strings.STOCKS : s.stitems_Type == 1 ? strings.STOCKS_WITH_SERIAL : "",
stitems_Code = s.stitems_Code,
stitems_NationalCode = s.stitems_NationalCode,
DetunitID = s.DetunitID,
UnitName = s.UnitName,
ID = s.ID,
mID = s.mID,
OpType = s.OpType,
OpName = strings.ResourceManager.GetString(s.OpType, strings.Culture),
OpDate = s.OpDate,
r_branche_ID = s.r_branche_ID,
branche_Name = s.branche_Name,
IncmQnt = s.IncmQnt,
OutQnt = s.OutQnt,
cost = s.cost,
TotalCost = s.TotalCost,
FromStore = s.FromStore,
fstore_Name = s.fstore_Name,
ToStore = s.ToStore,
tstore_Name = s.tstore_Name,
StartStatus = strings.ResourceManager.GetString(s.StartStatus, strings.Culture),
EndStatus = strings.ResourceManager.GetString(s.EndStatus, strings.Culture)
});