I am trying to create a query that shows the potential by the department and then the month. I do not have any information for that month, even if there is no data for that month. Requires every month to join.
The first query works fine to get the data, as is the simple query to get the last twelve months.
However, when I try to leave the exterior, I get a nonsense exception, even though I am new to every new selection.
I do not know where I'm going wrong ...
var departmentprints = (In contract, join the contract in the contract on O.O. Contract contract. Equivalence. Toastring () New O.O. Department, O.Lastwalkart, year, o.LastWorkDate.Month} dm where dm.Sum (o = & gt; o.ActualHours) & gt; 0 selection new {div = Dm.Key.Department, year = dm.Key.Year, month = dm.Key. Mute, Efficiency = DM. Sam (o = & gt; o Plated Horse) / DM. Sam (o = & gt; Realhors)}); Var now = datetime.Now; Var months = exclusive Category (-12, 12). Select (x = & gt; new {year = now.admnths (x) year, month = now addMonths (x) .month}); Var Department All the environments = (Within months, the department can join the department in the first months of the year.) The efficiency of the first new month (month = M. silence, year = m.moth) new {month = deputy moneth. Year, year = year-wise, month. All the heads of posts in all positions in the departments with all the positions divided in the terms of the year} Default IFEmpty () selection of new {departments = deptAllMonth.Department == "Empty": deptAllMonth.Department, year = m.Year = = Null 2019:? M.Year, month = m.month == null 12: meet . Month, efficiency = department all models. Capacity == null? 0: Department all models. Capacity}). ToList ();
keyword join
(usually an internal join With) extension with the DefaultIfEmpty
LINQ in an external insertion (and LINQ-to-units will be made when the actual SQL is generated). The default IfEmpty
says that & mdash; deptsWithAllMonths
should be a blank set & mdash; Instead of returning a single, default, object set ... ... the default object for the anonymous type coming back from the first query is null
:
Select new {department = department all models == weak} DeptAllMonth.Department == Zero? "Empty": the department, all the silence Department, year = m. Year, month = m. Silence, efficiency = department, all silent == zero || DeptAllMonth.Efficiency == Zero? 0: deptAllMonth.Efficiency}
However, you should consider this advice:. One of the important aspects of using the navigation properties applies to your question:
Both LINQs from LINQ include LINQs for nulls and units.
No comments:
Post a Comment