public static WorkReport Get(long oid, bool childs, bool cache, int sessionCode) { WorkReport item; if (!cache) { return(Get(oid, childs)); } //Está en la cache de listas if (Cache.Instance.Contains(typeof(WorkReports))) { WorkReports items = Cache.Instance.Get(typeof(WorkReports)) as WorkReports; item = items.GetItem(oid); //No está en la lista de la cache de listas if (item == null) { item = WorkReport.GetChild(items.SessionCode, oid, childs); items.AddItem(item); Cache.Instance.Save(typeof(WorkReports), items); } } //Está en la cache de objetos else if (Cache.Instance.Contains(typeof(WorkReport))) { item = Cache.Instance.Get(typeof(WorkReport)) as WorkReport; } else { WorkReports items = WorkReports.NewList(); item = sessionCode == -1 ? WorkReport.GetChild(oid, childs) : WorkReport.GetChild(sessionCode, oid, childs); items.AddItem(item); items.SessionCode = item.SessionCode; Cache.Instance.Save(typeof(WorkReports), items); } return(item); }