Esempio n. 1
0
        public RepositoryFactory(Type t)
        {
            this.type = t;
            switch (type)
            {
            case Type.Csv:
                KeywordRepository = new Csv.KeywordRepository(DatabaseName);
                PhotoRepository   = new Csv.PhotoRepository(DatabaseName, KeywordRepository);
                break;

            case Type.EF:
                // TODO: EFに適した生成に変更してください
                SqlProviderServices sqlProviderServices = SqlProviderServices.Instance;
                KeywordRepository = new EF.KeywordRepository(sqlProviderServices);
                PhotoRepository   = new EF.PhotoRepository(KeywordRepository, sqlProviderServices);
                break;

            default:
                throw new ArgumentException("The specified type is not supported.");
            }
        }
 public PhotoRepository(string databaseName, KeywordRepository keywordRepository)
 {
     this.CsvFilePath       = $"{databaseName}_Photo.csv"; // $"{...}" : 文字列展開
     this.keywordRepository = keywordRepository;
 }