public ICollection <T> SelectAll <T>(T type) where T : new() { Type entType = type.GetType(); if (entType == typeof(City)) { return((ICollection <T>)CityTable.Select()); } if (entType == typeof(Customer)) { return((ICollection <T>)CustomerTable.Select()); } if (entType == typeof(Distillation)) { return((ICollection <T>)DistillationTable.Select()); } if (entType == typeof(District)) { return((ICollection <T>)DistrictTable.Select()); } if (entType == typeof(Material)) { return((ICollection <T>)MaterialTable.Select()); } if (entType == typeof(Period)) { return((ICollection <T>)PeriodTable.Select()); } if (entType == typeof(Region)) { return((ICollection <T>)RegionTable.Select()); } if (entType == typeof(Reservation)) { return((ICollection <T>)ReservationTable.Select()); } if (entType == typeof(Season)) { return((ICollection <T>)SeasonTable.Select()); } if (entType == typeof(UserInfo)) { return((ICollection <T>)UserInfoTable.Select()); } return(null); }
public T Select <T>(T type, int primaryKey) where T : new() { Type entType = type.GetType(); if (entType == typeof(City)) { return((T)Convert.ChangeType(CityTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Customer)) { return((T)Convert.ChangeType(CustomerTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Distillation)) { return((T)Convert.ChangeType(DistillationTable.Select(primaryKey), typeof(T))); } if (entType == typeof(District)) { return((T)Convert.ChangeType(DistrictTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Material)) { return((T)Convert.ChangeType(MaterialTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Period)) { return((T)Convert.ChangeType(PeriodTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Region)) { return((T)Convert.ChangeType(RegionTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Reservation)) { return((T)Convert.ChangeType(ReservationTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Season)) { return((T)Convert.ChangeType(SeasonTable.Select(primaryKey), typeof(T))); } if (entType == typeof(UserInfo)) { return((T)Convert.ChangeType(UserInfoTable.Select(primaryKey), typeof(T))); } return(default(T)); }