public static IEnumerable <Repository> Create(IEnumerable <DataSource> dataSources, IRepositorySelect repositorySelection)
        {
            var repositories = new List <Repository>();

            dataSources.ForEach(p =>
            {
                var dbType = (DataBaseType)p.DbType;

                if (PersistenceConfig.IsRemoteDatabase(dbType))
                {
                    repositories.Add(new RepositoryRemote(p));
                }
                else if (dbType == DataBaseType.Sqlite)
                {
                    repositories.Add(new RepositorySqlite(p));
                }
                else if (dbType == DataBaseType.CSV)
                {
                    repositories.Add(new RepositoryCsvFile(p));
                }
                else if (dbType == DataBaseType.Memory)
                {
                    repositories.Add(new RepositoryMemory(p, repositorySelection));
                }
                else
                {
                    throw new Exception($"不支持的数据库类型 {dbType}。");
                }
            });

            return(repositories);
        }
Beispiel #2
0
 public RepositoryMemory(DataSource dataSrc, IRepositorySelect reposSelector)
     : base(dataSrc)
 {
     this.RepositorySelector = reposSelector;
 }