using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.SqlClient; using TinyPosEntity; namespace TinyPosDBGen { class Program { static void Main(string[] args) { string source = "localhost"; string catalog = "TestDB"; string userId = "sa"; string userPassword = ""; Console.WriteLine("데이터베이스를 초기화합니다."); Console.WriteLine("(※※※ 경고: 기존 데이터베이스 데이터는 모두 삭제됩니다. ※※※)"); Console.WriteLine(); InputValue("서버 이름", ref source); InputValue("데이터베이스 이름", ref catalog); InputValue("인증 사용자 계정", ref userId); InputValue("인증 사용자 비밀번호", ref userPassword); string connString = string.Format("data source={0};initial catalog={1};user id={2};password={3};", source, catalog, userId, userPassword); Console.WriteLine(); Console.WriteLine("데이터베이스를 초기화 합니다."); EntityController.ConnectionString = connString; EntityController.GetInstance().Initialize(); Console.WriteLine("초기화가 완료되었습니다."); Console.WriteLine(); Console.WriteLine("종료를 위해 아무키나 누르세요."); Console.ReadKey(); //Student student = new Student() //{ // StudentName = "테스트용", // Height = 180 //}; ////EntityController.GetInstance().AddStudent(student); //List students = EntityController.GetInstance().FindStudent("테스트용"); //if (students.Count > 0) //{ // foreach (Student item in students) // { // EntityController.GetInstance().RemoveStudent(student); // } //} } static void InputValue(string message, ref string target) { Console.Write(message + ": "); string input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) return; target = input; } } }