public async Task <Result <IFetchResult <IModel <Record> > > > Get(IFetch fetch, int userId) { try { var expression = _fetchProvider.Compile(fetch, userId); var resultRecords = await _recordRepo.GetMany(expression, fetch); if (!resultRecords.IsSuccess) { return(Result <IFetchResult <IModel <Record> > > .Error(resultRecords.ErrorCodes)); } List <IModel <Record> > records = new List <IModel <Record> >(); foreach (var record in resultRecords.Data.Items) { records.Add(new RecordModel(record)); } IFetchResult <IModel <Record> > fetchResult = new FetchResult <IModel <Record> >( records, fetch.PageNumber, fetch.PageSize); return(Result <IFetchResult <IModel <Record> > > .Success(fetchResult)); } catch (Exception ex) { _logger.LogError(ex.Message); } return(Result <IFetchResult <IModel <Record> > > .Error(ErrorCodes.UNEXPECTED)); }
public HandleFetchingApiPushConfiguration(IFetch<FetchConfigurationCommand, IEnumerable<ApiPushIntegration>> fetcher, IFetch<FetchConfigurationForCustomCommand, IEnumerable<ApiPushIntegration>> customFetcher, IFetch<FetchConfigurationForClientCommand, IEnumerable<ApiPushIntegration>> clientFetcher) { _customFetcher = customFetcher; _fetcher = fetcher; _clientFetcher = clientFetcher; }
public object Execute(object command, IFetch executor) { try { return executor.Fetch(command); } finally { _container.Release(executor); } }
public Expression <Func <Record, bool> > Compile(IFetch fetch, int userId) { DateTime.TryParse(fetch.Value, out DateTime dateValue); return((record) => (record.FirstName.Contains(fetch.Value) || record.LastName.Contains(fetch.Value) || record.Surname.Contains(fetch.Value) || record.DateOfBirth.Value.Equals(dateValue) || record.Info.Contains(fetch.Value) || record.Phone.Contains(fetch.Value)) && record.UserId == userId); }
public Piledriver() { monitoringConfigs = new MonitoringConfig[11]; monitoringConfigs[0] = new BpuMonitoringConfig(this); monitoringConfigs[1] = new IFetch(this); monitoringConfigs[2] = new DataCache(this); monitoringConfigs[3] = new DataCache1(this); monitoringConfigs[4] = new L2Cache(this); monitoringConfigs[5] = new DispatchStall(this); monitoringConfigs[6] = new DispatchStall1(this); monitoringConfigs[7] = new DispatchStallFP(this); monitoringConfigs[8] = new DispatchStallMisc(this); monitoringConfigs[9] = new DTLB(this); monitoringConfigs[10] = new FPU(this); architectureName = "Piledriver"; }
public ArrayModel(IFetch fetch, uint xSize, uint ySize, uint zSize) { Voxels = new byte[xSize][][]; for (uint x = 0; x < Voxels.Length; x++) { Voxels[x] = new byte[ySize][]; for (uint y = 0; y < Voxels[x].Length; y++) { Voxels[x][y] = new byte[zSize]; for (uint z = 0; z < Voxels[x][y].Length; z++) { Voxels[x][y][z] = fetch.At((int)x, (int)y, (int)z); } } } }
/// <summary> /// アドオンを初期化する /// </summary> /// <returns></returns> public async Task <IAttemptResult> InitializeAsync() { if (this.isInitialized) { return(new AttemptResult() { Message = "既に初期化されています。" }); } this._initializeAwaiterHandler.RegisterStep(AwaiterNames.Addon, typeof(VM::MainWindowViewModel)); await this._initializeAwaiterHandler.GetAwaiter(AwaiterNames.Addon); IAttemptResult dResult = this._uninstaller.DeleteListed(); if (!dResult.IsSucceeded) { return(new AttemptResult() { Message = "アンインストール済みアドオンフォルダーの削除に失敗しました。", Exception = dResult.Exception }); } IAttemptResult mResult = this._installer.ReplaceTemporaryFiles(); if (!mResult.IsSucceeded) { return(new AttemptResult() { Message = mResult.Message, Exception = mResult.Exception }); } List <string> packages; try { packages = this._directoryIO.GetDirectorys(FileFolder.AddonsFolder); } catch (Exception e) { this._logger.Error("アドオンパッケージ一覧の取得に失敗しました。", e); return(new AttemptResult() { Message = "アドオンパッケージ一覧の取得に失敗しました。", Exception = e }); } bool isDevMode = this._settingHandler.GetBoolSetting(SettingsEnum.IsDevMode); bool isAddonDebuggingEnable = this._settingHandler.GetBoolSetting(SettingsEnum.IsAddonDebugEnable); foreach (var packagePath in packages) { string package = Path.GetFileName(packagePath); IAttemptResult <bool> result = await this._engine.InitializeAsync(package, isDevMode); if (!result.IsSucceeded) { var failedResult = new FailedAddonResult(package, result.Message ?? string.Empty, result.Data); this.LoadFailedAddons.Add(failedResult); } } foreach (KeyValuePair <int, IAddonContext> item in this._contexts.Contexts) { AddonInfomation info = this._container.GetAddon(item.Key); IAPIEntryPoint entryPoint = DIFactory.Provider.GetRequiredService <IAPIEntryPoint>(); IAttemptResult result = item.Value.Initialize(info, engine => { entryPoint.Initialize(info, engine); engine.AddHostObject("application", entryPoint); IFetch fetch = DIFactory.Provider.GetRequiredService <IFetch>(); fetch.Initialize(info); Func <string, dynamic?, Task <Response> > fetchFunc = (url, optionObj) => { var option = new FetchOption() { method = optionObj?.method, body = optionObj?.body, credentials = optionObj?.credentials, }; return(fetch.FetchAsync(url, option)); }; engine.AddHostObject("fetch", fetchFunc); }, entryPoint, isAddonDebuggingEnable); if (!result.IsSucceeded) { var failedResult = new FailedAddonResult(info.PackageID.Value, result.Message ?? string.Empty, true); this.LoadFailedAddons.Add(failedResult); } } IAttemptResult <IEnumerable <string> > packageIds = this._storeHandler.GetAllAddonsPackageID(); if (packageIds.IsSucceeded && packageIds.Data is not null) { List <string> loaded = this._contexts.Contexts.Select(v => v.Value.AddonInfomation !.PackageID.Value).ToList(); foreach (var package in packageIds.Data) { if (!loaded.Contains(package)) { var failedResult = new FailedAddonResult(package, "インストールされていますが、ファイルが見つかりませんでした。", true); this.LoadFailedAddons.Add(failedResult); } } } this.isInitialized = true; return(new AttemptResult() { IsSucceeded = true }); }
public HandleFetchingFlatFilePullConfiguration(IFetch<FetchConfigurationCommand, List<FlatFilePullIntegration>> fetcher) { _fetcher = fetcher; }
public IEnumerable <TEntity> FindWithPaging(ISpecification <TEntity> specification = null, IFetch <TEntity> fetch = null, ISort <TEntity> sort = null, int page = 1, int pageSize = 25) { return(GetPagedQuery(specification, fetch, sort, page, pageSize).ToList()); }
protected IQueryable <TEntity> GetPagedQuery(ISpecification <TEntity> specification = null, IFetch <TEntity> fetch = null, ISort <TEntity> sort = null, int page = 1, int pageSize = 25) { var query = GetQuery(specification, fetch, sort); if (page < 1) { page = 1; } if (pageSize < 1 || pageSize > 1000) { pageSize = 100; } var all = query.Skip((page - 1) * pageSize).Take(pageSize); return(all); }
public T FetchSingle <T>(IFetch fetch) where T : new() { var result = fetch.ExecuteSingle <T>(_databaseconnection); return(result); }
public void Display(IFetch <T> fetch, int id) { myLabel.Text = fetch.Fetch(id).ToString(); }
public async Task <Result <IFetchResult <T> > > GetMany(Expression <Func <T, bool> > expression, IFetch fetch) { List <T> entities = await _set.Where(expression) .Skip(fetch.PageNumber * fetch.PageSize) .Take(fetch.PageSize) .ToListAsync(); return(Result <IFetchResult <T> > .Success( new FetchResult <T>(entities, fetch.PageNumber, fetch.PageSize))); }
public Task <Result <IFetchResult <T> > > GetMany(Expression <Func <T, bool> > expression, IFetch fetch) { IEnumerable <T> entities = _items.Where(expression.Compile()) .Skip(fetch.PageNumber * fetch.PageSize) .Take(fetch.PageSize); return(Task.FromResult(Result <IFetchResult <T> > .Success( new FetchResult <T>(entities, fetch.PageNumber, fetch.PageSize)))); }
public List <T> Fetch <T>(IFetch fetch) where T : new() { var result = fetch.Execute <T>(_databaseconnection); return(result); }
protected IQueryable <TEntity> GetQuery(ISpecification <TEntity> specification = null, IFetch <TEntity> fetch = null, ISort <TEntity> sort = null) { var query = dbSet.AsQueryable(); if (specification != null) { query = query.Where(specification.IsSatisfiedBy()); } if (sort != null) { query = sort.AcceptQuery(query); } if (fetch != null) { query = fetch.AcceptQuery(query); } return(query); }
//here's the magic sauce for the unittests public FetchCms(IFetch fetch, RockStar rs) { this.fetch = fetch; this.rs = rs; }
public IEnumerable <TEntity> Find(ISpecification <TEntity> specification = null, IFetch <TEntity> fetch = null, ISort <TEntity> sort = null) { return(GetQuery(specification, fetch, sort).ToList()); }
public NasaFetcherTransformerDecorator(IFetch <Nasa> fetcher) { _fetcher = fetcher; }
public TEntity Read(ISpecification <TEntity> specification, IFetch <TEntity> fetch = null) { return(GetQuery(specification, fetch).FirstOrDefault()); }