У меня есть класс Country, в котором есть коллекции Cities.
У клиента я использую webmethod
[WebMethod]
public void AddCity(string countryCode,string name)
{
MyFacade.AddCity(countryCode,name);
}
, на Фасаде у меня есть метод
public void AddCity(string countryCode,string name)
{
Country.AddCity(countryCode,name); <-in this method is simple sql operation
}
и ядро.моего вопроса:
public class Country
{
public static void AddCity(string countryCode, string cityName)
{
//insert into table cities new city
}
}
Это нормально?Или я должен создать objectCountry, и там есть нестатический метод AddCity?
И еще вопрос:
Лучше использовать:
City[] cities= Country.GetAllCities(countryCode)
или
City[] cities= new Country(countryCode).GetAllCities()