private IList <T> Aggregated <T>(int aggregatedBy) { var type = typeof(T); if (type == typeof(Instance3D)) { var el = ThreeDInstances.Where(x => x.AggregatedBy == aggregatedBy); return(el.Select(x => (T)Convert.ChangeType(x, type)).ToList()); } else if (type == typeof(InstanceRep)) { var el = InstanceReps.Where(x => x.AggregatedBy == aggregatedBy); return(el.Select(x => (T)Convert.ChangeType(x, type)).ToList()); } throw new Exception("Type for T not found."); }
/// <summary> /// /// </summary> public T Get <T>(int id) { var type = typeof(T); if (type == typeof(Reference3D)) { return((T)Convert.ChangeType(ThreeDReferences.First(x => x.Id == id), type)); } if (type == typeof(Instance3D)) { return((T)Convert.ChangeType(ThreeDInstances.First(x => x.Id == id), type)); } if (type == typeof(ReferenceRep)) { return((T)Convert.ChangeType(ReferenceReps.First(x => x.Id == id), type)); } if (type == typeof(InstanceRep)) { return((T)Convert.ChangeType(InstanceReps.First(x => x.Id == id), type)); } throw new Exception("Type for R not found."); }