Change all the List properties to ICollection
Apparently one should develop against an interface and not against the implementation because the interface defines the contract. https://stackoverflow.com/questions/7655845/icollectiont-vs-listt-in-entity-framework
This commit is contained in:
parent
ffa552c8de
commit
e454a19d61
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class CityDB
|
||||
{
|
||||
public List<City> GetAllCities()
|
||||
public ICollection<City> GetAllCities()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class CountryDB
|
||||
{
|
||||
public List<Country> GetAllCountries()
|
||||
public ICollection<Country> GetAllCountries()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class DoctorDB
|
||||
{
|
||||
public List<Doctor> GetAllDoctors()
|
||||
public ICollection<Doctor> GetAllDoctors()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class ExamDB
|
||||
{
|
||||
public List<Exam> GetAllExams()
|
||||
public ICollection<Exam> GetAllExams()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class FoodPlaceDB
|
||||
{
|
||||
public List<FoodPlace> GetAllFoodPlaces()
|
||||
public ICollection<FoodPlace> GetAllFoodPlaces()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class GenderDB
|
||||
{
|
||||
public List<Gender> GetAllGenders()
|
||||
public ICollection<Gender> GetAllGenders()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class PersonDB
|
||||
{
|
||||
public List<Person> GetAllPersons()
|
||||
public ICollection<Person> GetAllPersons()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class SalutationDB
|
||||
{
|
||||
public List<Salutation> GetAllSalutations()
|
||||
public ICollection<Salutation> GetAllSalutations()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Server.DB
|
|||
{
|
||||
public class StrainDB
|
||||
{
|
||||
public List<Strain> GetAllStrains()
|
||||
public ICollection<Strain> GetAllStrains()
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Server
|
|||
Database.SetInitializer(new EntitiesContextInitializer());
|
||||
// Workaround to get the DB filled at first run
|
||||
SalutationDB salutations = new SalutationDB();
|
||||
List<Salutation> salutationList = new List<Salutation>();
|
||||
ICollection<Salutation> salutationList = new List<Salutation>();
|
||||
salutationList = salutations.GetAllSalutations();
|
||||
// End of workaround
|
||||
}
|
||||
|
|
|
@ -23,18 +23,18 @@ namespace Server
|
|||
[OperationContract]
|
||||
void WriteFoodPlace(FoodPlace foodplace);
|
||||
[OperationContract]
|
||||
List<Gender> GetGenders();
|
||||
ICollection<Gender> GetGenders();
|
||||
[OperationContract]
|
||||
List<Salutation> GetSalutations();
|
||||
ICollection<Salutation> GetSalutations();
|
||||
[OperationContract]
|
||||
List<Strain> GetStrains();
|
||||
ICollection<Strain> GetStrains();
|
||||
[OperationContract]
|
||||
List<Doctor> GetDoctors();
|
||||
ICollection<Doctor> GetDoctors();
|
||||
[OperationContract]
|
||||
List<City> GetCities();
|
||||
ICollection<City> GetCities();
|
||||
[OperationContract]
|
||||
List<Country> GetCountries();
|
||||
ICollection<Country> GetCountries();
|
||||
[OperationContract]
|
||||
List<FoodPlace> GetFoodPlaces();
|
||||
ICollection<FoodPlace> GetFoodPlaces();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,43 +13,43 @@ namespace Server
|
|||
// NOTE: In order to launch WCF Test Client for testing this service, please select Service.svc or Service.svc.cs at the Solution Explorer and start debugging.
|
||||
public class Service : IService
|
||||
{
|
||||
public List<Doctor> GetDoctors()
|
||||
public ICollection<Doctor>GetDoctors()
|
||||
{
|
||||
DoctorDB dataaccess = new DoctorDB();
|
||||
return dataaccess.GetAllDoctors();
|
||||
}
|
||||
|
||||
public List<Gender> GetGenders()
|
||||
public ICollection<Gender> GetGenders()
|
||||
{
|
||||
GenderDB dataaccess = new GenderDB();
|
||||
return dataaccess.GetAllGenders();
|
||||
}
|
||||
|
||||
public List<Salutation> GetSalutations()
|
||||
public ICollection<Salutation> GetSalutations()
|
||||
{
|
||||
SalutationDB dataaccess = new SalutationDB();
|
||||
return dataaccess.GetAllSalutations();
|
||||
}
|
||||
|
||||
public List<Strain> GetStrains()
|
||||
public ICollection<Strain> GetStrains()
|
||||
{
|
||||
StrainDB dataaccess = new StrainDB();
|
||||
return dataaccess.GetAllStrains();
|
||||
}
|
||||
|
||||
public List<City> GetCities()
|
||||
public ICollection<City> GetCities()
|
||||
{
|
||||
CityDB dataaccess = new CityDB();
|
||||
return dataaccess.GetAllCities();
|
||||
}
|
||||
|
||||
public List<Country> GetCountries()
|
||||
public ICollection<Country> GetCountries()
|
||||
{
|
||||
CountryDB dataaccess = new CountryDB();
|
||||
return dataaccess.GetAllCountries();
|
||||
}
|
||||
|
||||
public List<FoodPlace> GetFoodPlaces()
|
||||
public ICollection<FoodPlace> GetFoodPlaces()
|
||||
{
|
||||
FoodPlaceDB dataaccess = new FoodPlaceDB();
|
||||
return dataaccess.GetAllFoodPlaces();
|
||||
|
|
Loading…
Reference in New Issue