I've tried the below LINQ Query in Linqer it is working fine but it is giving the below error while i tried with C#
from IHeal_Mnt_Tickets in iHealEntities.iHeal_Mnt_Tickets
where
Tickets.Active == 1 &&
Tickets.MntID == 1 &&
Tickets.InsertedOn >= fromdate &&
Mnt_Tickets.InsertedOn <= todate &&
(new string[] { "Resolved", "Assigned" }).Contains(Tickets.status)
group Tickets by new {
Tickets.Instance
} into g
select new {
Instance = g.Key.Summus_Instance,
Assigned = (Int64?)g.Count(p => p.iHealID != null),
resolved = (System.Int64?)g.Sum(p => (p.status == "Resolved" ? 1 : 0)),
domain = (System.Int64?)g.Sum(p => (p.status == "Assigned" ? 1 : 0)),
iHeal_Closure = (Decimal?)Math.Round((Double)(Double)g.Sum(p => (p.iHeal_Cur_status == "Resolved" ? 1 : 0)) * 1.0 / (Double)g.Count(p => p.iHealID != null) * 100, 2, MidpointRounding.AwayFromZero)
};
The error is
"LINQ to Entities does not recognize the method 'Double Round(Double, Int32, System.MidpointRounding)' method, and this method cannot be translated into a store expression."