예제 #1
0
        private void SetApartmentStorageProperties()
        {
            //ApartmentStorageInfoList = new ObservableCollection<ApartmentStorageEnum>();
            ApartmentStorageInfoList = Enum.GetValues(typeof(ApartmentStorageEnum)).Cast <ApartmentStorageEnum>().ToList();

            CurrentApartmentStorageInfo = ApartmentStorageInfoList[0];
        }
예제 #2
0
        public IApartmentStorage CreateApartmentStorage(ApartmentStorageEnum type)
        {
            IApartmentStorage result = null;

            if (!Enum.IsDefined(typeof(ApartmentStorageEnum), type))
            {
                throw new ArgumentException("Unhandled ApartmentStorageEnum value");
            }

            switch (type)
            {
            case ApartmentStorageEnum.CSV:
            {
                result = new CsvApartmentStorage(GetConnectionString(type));
                break;
            }

            case ApartmentStorageEnum.SQL:
            {
                result = new SqlApartmentStorage(GetConnectionString(type));
                break;
            }

            case ApartmentStorageEnum.SQLite:
            {
                result = new SqliteApartmentStorage(GetConnectionString(type));
                break;
            }

            default:
            {
                throw new NotImplementedException("Unsupported ApartmentStorageEnum value.");
            }
            }

            return(result);
        }
예제 #3
0
 private string GetConnectionString(ApartmentStorageEnum type)
 {
     return(ConfigurationManager.ConnectionStrings[type.ToString()]?.ConnectionString);
 }