static void Main(string[] args) { //устанавливается соеденение с БД и запуск сервиса string conStr = ConfigurationManager.ConnectionStrings["PT1_DB"].ConnectionString; ContextCreator creator = new ContextCreator(conStr); using (ServiceHostForRIS host = new ServiceHostForRIS(typeof(RISI.RelativesInfoService), creator)) { host.Open(); Console.WriteLine("Service ready...\npress any key to shut it down"); Console.ReadKey(); host.Close(); }; }
public static void ServiceTest() { ContextCreator creator = new ContextCreator(conStr); context = creator.CreateContext(); persones = context.CreateRepository<Person>(); relationships = context.CreateRepository<Relationship>(); using (ServiceHostForRIS host = new ServiceHostForRIS(typeof(RISI.RelativesInfoService), creator)) { host.Open(); Console.WriteLine("Service ready..."); Console.WriteLine("Start TestGetPersonInfo"); Console.WriteLine("XML"); dataFormat = "xml"; TestGetPersonInfo(); Console.WriteLine("JSON"); dataFormat = "json"; TestGetPersonInfo(); Console.WriteLine(); Console.WriteLine("Start TestGetRelativesList"); Console.WriteLine("XML"); dataFormat = "xml"; TestGetRelativesList(); Console.WriteLine("JSON"); dataFormat = "json"; TestGetRelativesList(); Console.WriteLine(); Console.WriteLine("Start TestAddRelative"); TestAddRelative(); Console.WriteLine(); Console.WriteLine("Start TestUpdateRelative"); TestUpdateRelative(); Console.WriteLine(); Console.WriteLine("Start TestUpdateRelationshipState"); TestUpdateRelationshipState(); Console.WriteLine(); Console.WriteLine("Start TestDeleteRelative"); TestDeleteRelative(); host.Close(); }; }