public BeforeQueryEventArgs(IRepositoryQuery query, ICommandOptions options, IReadOnlyRepository <T> repository, Type resultType) { Query = query; Options = options; Repository = repository; ResultType = resultType; }
public async Task <bool> ExistsAsync(IRepositoryQuery query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } var options = ConfigureOptions(null); await OnBeforeQueryAsync(query, options, typeof(T)).AnyContext(); var searchDescriptor = (await CreateSearchDescriptorAsync(query, options).AnyContext()).Size(1); searchDescriptor.DocvalueFields(_idField); var response = await _client.SearchAsync <T>(searchDescriptor).AnyContext(); _logger.Trace(() => response.GetRequest()); if (!response.IsValid) { if (response.ApiCall.HttpStatusCode.GetValueOrDefault() == 404) { return(false); } string message = response.GetErrorMessage(); _logger.Error().Exception(response.OriginalException).Message(message).Property("request", response.GetRequest()).Write(); throw new ApplicationException(message, response.OriginalException); } return(response.HitsMetaData.Total > 0); }
public PortalPermissionController(IActivityLogRepositoryCommand activityRepo, IRepositoryCommand <Permission, long> permissionCommand, IRepositoryQuery <Permission, long> permissionQuery, ILog log) { _permissionCommand = permissionCommand; _permissionyQuery = permissionQuery; _activityRepo = activityRepo; _log = log; }
public ActivityLogReportController(IRepositoryCommand <ActivityLog, long> activitylogCommand, IRepositoryQuery <ActivityLog, long> activitylogQuery, IRepositoryQuery <ApplicationUser, long> applicationUserQuery, ILog log) { _activitylogCommand = activitylogCommand; _activitylogQuery = activitylogQuery; _applicationUserQuery = applicationUserQuery; _log = log; }
public HangfireEmailJob() { _log = log4net.LogManager.GetLogger("HangFireLoggerAppender"); _emailJobQuery = new RepositoryQuery <EmailLog, long>(); _emailJobCommand = new RepositoryCommand <EmailLog, long>(); _emailAttachmentQuery = new RepositoryQuery <EmailAttachment, long>(); }
private async Task OnBeforeQueryAsync(IRepositoryQuery query, ICommandOptions options, Type resultType) { if (SupportsSoftDeletes && IsCacheEnabled && options.GetSoftDeleteMode() == SoftDeleteQueryMode.ActiveOnly) { var deletedIds = await Cache.GetListAsync <string>("deleted").AnyContext(); if (deletedIds.HasValue) { query.ExcludedId(deletedIds.Value); } } var systemFilter = query.GetSystemFilter(); if (systemFilter != null) { query.MergeFrom(systemFilter.GetQuery()); } if (BeforeQuery == null || !BeforeQuery.HasHandlers) { return; } await BeforeQuery.InvokeAsync(this, new BeforeQueryEventArgs <T>(query, options, this, resultType)).AnyContext(); }
public virtual async Task <bool> ExistsAsync(IRepositoryQuery query, ICommandOptions options = null) { options = ConfigureOptions(options.As <T>()); await OnBeforeQueryAsync(query, options, typeof(T)).AnyContext(); await RefreshForConsistency(query, options).AnyContext(); var searchDescriptor = (await CreateSearchDescriptorAsync(query, options).AnyContext()).Size(0); searchDescriptor.DocValueFields(_idField.Value); var response = await _client.SearchAsync <T>(searchDescriptor).AnyContext(); if (response.IsValid) { _logger.LogRequest(response, options.GetQueryLogLevel()); } else { if (response.ApiCall.HttpStatusCode.GetValueOrDefault() == 404) { return(false); } _logger.LogErrorRequest(response, "Error checking if document exists"); throw new ApplicationException(response.GetErrorMessage(), response.OriginalException); } return(response.HitsMetadata.Total.Value > 0); }
//_emailLogRepositoryCommand public EmailSender(IOptions <AppSettings> settings, IRepositoryQuery <EmailTemplate, long> emailTemplateQuery, IRepositoryQuery <EmailToken, long> emailTokenQuery, IRepositoryCommand <EmailLog, long> emailLogRepositoryCommand) { _appSettings = settings.Value; _emailTemplateQuery = emailTemplateQuery; _emailTokenQuery = emailTokenQuery; _emailLogRepositoryCommand = emailLogRepositoryCommand; }
public AnuncioWebmotorsController(IAnuncioWebmotorsService anuncioWebmotorsService, IRepositoryQuery repositoryQuery, IValidatorFactory validatorFactory, IMapper mapper) { _anuncioWebmotorsService = anuncioWebmotorsService; _repositoryQuery = repositoryQuery; _validatorFactory = validatorFactory; _mapper = mapper; }
public UserService(ISSOService ssoService, IRepositoryCommand <User, long> userCommandRepo, IRepositoryQuery <User, long> userQueryRepo, IRepositoryCommand <UserRole, long> userRoleCommandRepo, IRepositoryQuery <UserRole, long> userRoleQueryRepo, IRepositoryQuery <Role, long> roleQueryRepo, IRepositoryQuery <Company, long> companyQueryRepo, IEmailService emailService, IMapper mapper, IOptions <SSoSetting> sSoSetting, IHttpContextExtensionService httpContext) { _ssoSettings = sSoSetting.Value; _ssoService = ssoService; _userCommandRepo = userCommandRepo; _userQueryRepo = userQueryRepo; _userRoleCommandRepo = userRoleCommandRepo; _roleQueryRepo = roleQueryRepo; _companyQueryRepo = companyQueryRepo; _emailService = emailService; _mapper = mapper; _userRoleQueryRepo = userRoleQueryRepo; _httpContext = httpContext; CurrentUserId = _httpContext.GetCurrentSSOUserId(); }
public virtual async Task <bool> ExistsAsync(IRepositoryQuery query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } var options = ConfigureOptions(null); await OnBeforeQueryAsync(query, options, typeof(T)).AnyContext(); var searchDescriptor = (await CreateSearchDescriptorAsync(query, options).AnyContext()).Size(1); searchDescriptor.DocvalueFields(_idField.Value); var response = await _client.SearchAsync <T>(searchDescriptor).AnyContext(); if (response.IsValid) { _logger.LogTraceRequest(response); } else { if (response.ApiCall.HttpStatusCode.GetValueOrDefault() == 404) { return(false); } _logger.LogErrorRequest(response, "Error checking if document exists"); throw new ApplicationException(response.GetErrorMessage(), response.OriginalException); } return(response.HitsMetaData.Total > 0); }
public FrameworkConfigController(ILogger <FrameworkConfigController> log, IActivityLogRepositoryCommand activityRepo, IRepositoryQuery <Application, int> application, IRepositoryQuery <ApplicationUser, long> applicationUser) { _applicationQuery = application; _applicationUserQuery = applicationUser; _activityRepo = activityRepo; _log = log; }
public PortalRoleController(IActivityLogRepositoryCommand activityRepo, IRepositoryCommand <RolePermission, long> rolePermissionCommand, IRepositoryQuery <RolePermission, long> rolePermissionQuery, Utility utility, ILog log) { _rolePermissionCommand = rolePermissionCommand; _rolePermissionyQuery = rolePermissionQuery; _activityRepo = activityRepo; _utility = utility; _log = log; }
public EventController(IActivityLogRepositoryCommand activityRepo, IRepositoryQuery <Event, long> eventQuery, IRepositoryCommand <Event, long> eventCommand, Utility utility, ILog log) { _activityRepo = activityRepo; _utility = utility; _EventQuery = eventQuery; _EventCommand = eventCommand; _log = log; }
public static IRepositoryQuery <TEntity> FilterCurrentCompany <TEntity>(this IRepositoryQuery <TEntity> rq) where TEntity : EntityBaseCompany { var bs = new BaseService(); Guid companyId = bs.GetCurrentCompanyId(); rq.Filter(x => x.companyId == companyId); return(rq); }
public Task <CountResult> CountBySearchAsync(IRepositoryQuery systemFilter, string filter = null, string aggregations = null) { var search = NewQuery() .WithSystemFilter(systemFilter) .WithFilter(filter) .WithAggregations(aggregations); return(CountAsync(search)); }
public static T ParentQuery <T>(this T query, IRepositoryQuery parentQuery) where T : IRepositoryQuery { if (parentQuery == null) { throw new ArgumentNullException(nameof(parentQuery)); } return(query.AddCollectionOptionValue(ParentQueriesKey, parentQuery)); }
public static IRepositoryQuery <TChild> ParentQuery <TChild, TParent>(this IRepositoryQuery <TChild> query, RepositoryQueryDescriptor <TParent> parentQuery) where TChild : class where TParent : class { if (parentQuery == null) { throw new ArgumentNullException(nameof(parentQuery)); } return(query.BuildOption(ParentQueryKey, parentQuery.Configure())); }
public static T ParentQuery <T>(this T query, IRepositoryQuery parentQuery) where T : IRepositoryQuery { if (parentQuery == null) { throw new ArgumentNullException(nameof(parentQuery)); } return(query.BuildOption(ParentQueryKey, parentQuery)); }
public PortalUserController(IActivityLogRepositoryCommand activityRepo, IRepositoryCommand <ApplicationUser, long> applicationUserCommand, Utility utility, IRepositoryQuery <ApplicationUser, long> applicationUser, IRepositoryCommand <ApplicationUserPasswordHistory, long> applicationUserPwdhistory, ILog log) { _applicationUserQuery = applicationUser; _applicationUserCommand = applicationUserCommand; _applicationUserPwdhistoryCommand = applicationUserPwdhistory; _activityRepo = activityRepo; _utility = utility; _log = log; }
public static IRepositoryQuery <T> Exclude <T>(this IRepositoryQuery <T> query, params Expression <Func <T, object> >[] objectPaths) where T : class { foreach (var objectPath in objectPaths) { query.Exclude(objectPath); } return(query); }
public EmailTemplateController(IActivityLogRepositoryCommand activityRepo, IRepositoryQuery <EmailToken, long> EmailTokenQuery, IRepositoryQuery <EmailTemplate, long> EmailTemplateQuery, Utility utility, IRepositoryCommand <EmailTemplate, long> EmailTemplateCommand, ILog log) { _EmailTemplateQuery = EmailTemplateQuery; _EmailTemplateCommand = EmailTemplateCommand; _EmailTokenQuery = EmailTokenQuery; _activityRepo = activityRepo; _utility = utility; _log = log; }
public FrameworkSetupController(IActivityLogRepositoryCommand activityRepo, IRepositoryQuery <Application, int> application, IRepositoryCommand <Application, int> applicationCommand, IRepositoryQuery <PortalVersion, int> portalversion, IRepositoryQuery <ApplicationUser, long> applicationUser, IRepositoryCommand <ApplicationUserPasswordHistory, long> applicationUserPwdhistory, ILog log) { _applicationQuery = application; _applicationCommand = applicationCommand; _applicationUserQuery = applicationUser; _applicationUserPwdhistoryCommand = applicationUserPwdhistory; _portalversionQuery = portalversion; _activityRepo = activityRepo; _log = log; }
public DepartmentService( IRepositoryCommand <Department, long> departmentCommandRepo, IRepositoryQuery <Department, long> departmentQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _departmentCommandRepo = departmentCommandRepo; _departmentQueryRepo = departmentQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public CompanyService( IRepositoryCommand <Company, long> companyCommandRepo, IRepositoryQuery <Company, long> companyQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _companyCommandRepo = companyCommandRepo; _companyQueryRepo = companyQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public PortalPermissionController(IActivityLogRepositoryCommand activityRepo, IRepositoryCommand <Permission, long> permissionCommand, IRepositoryQuery <Permission, long> permissionQuery, ILogger <PortalPermissionController> log, IMapper mapper) { _permissionCommand = permissionCommand; _permissionyQuery = permissionQuery; _activityRepo = activityRepo; _log = log; _mapper = mapper; }
//ApplicationUserManager userManager, ApplicationSignInManager signInManager, public AccountController(IRepositoryQuery <Application, int> applicationQuery, IRepositoryQuery <ApplicationUser, long> applicationUser, IRepositoryCommand <ApplicationUserPasswordHistory, long> passwordCommand, Utility utility, ILog log) { //UserManager = userManager; //_signInManager = signInManager; _applicationUser = applicationUser; _passwordCommand = passwordCommand; _applicationQuery = applicationQuery; _utility = utility; _log = log; }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IActivityLogRepositoryCommand activityRepo, IRepositoryCommand <ApplicationUser, long> applicationUserCommand, IRepositoryQuery <Application, int> applicationQuery, IRepositoryQuery <ApplicationUser, long> applicationUser, IRepositoryCommand <ApplicationUserPasswordHistory, long> passwordCommand, Utility utility, ILog log) { _userManager = userManager; _signInManager = signInManager; _applicationUser = applicationUser; _applicationUserCommand = applicationUserCommand; _passwordCommand = passwordCommand; _applicationQuery = applicationQuery; _activityRepo = activityRepo; _utility = utility; _log = log; }
public Task <FindResults <T> > SearchAsync(IRepositoryQuery systemFilter, string filter = null, string criteria = null, string sort = null, string aggregations = null, PagingOptions paging = null) { var search = NewQuery() .WithSystemFilter(systemFilter) .WithFilter(filter) .WithSearchQuery(criteria, false) .WithAggregations(aggregations) .WithSort(sort) .WithPaging(paging); return(FindAsync(search)); }
public MetricService( IRepositoryCommand <Metric, long> metricCommandRepo, IRepositoryQuery <Metric, long> metricQueryRepo, IRepositoryQuery <Department, long> departmentQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _metricCommandRepo = metricCommandRepo; _metricQueryRepo = metricQueryRepo; _departmentQueryRepo = departmentQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public QueryContainer(IRepositoryQuery currentQuery) { Query = currentQuery; }