public RelationalDbStubSource( IOptions <SettingsModel> options, IQueryStore queryStore) { _settings = options.Value; _queryStore = queryStore; }
protected QueryEventsHandler(IQueryStore <T> queryStore, IEventStore eventStore) { this.queryStore = queryStore; this.eventStore = eventStore; this.handlers = ReflectionUtils.FindQueryEventHandlerMethods <T>(this); }
private IQueryStore CreateQueryStore(ClientDto clientPoco) { IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParamCount(QueryType.QueryCity, "POBLACIONES", "CP", clientPoco.CP); store.AddParamCount(QueryType.QueryProvince, "PROVINCIA", "SIGLAS", clientPoco.PROVINCIA); store.AddParamCount(QueryType.QueryCountry, "PAIS", "SIGLAS", clientPoco.NACIODOMI); store.AddParamCount(QueryType.QueryClientType, "TIPOCLI", "NUM_TICLI", clientPoco.TIPOCLI); store.AddParamCount(QueryType.QueryMarket, "MERCADO", "CODIGO", clientPoco.MERCADO); store.AddParamCount(QueryType.QueryZone, "ZONAS", "NUM_ZONA", clientPoco.ZONA); store.AddParamCount(QueryType.QueryLanguage, "IDIOMAS", "CODIGO", ValueToString(clientPoco.IDIOMA)); store.AddParamCount(QueryType.QueryCreditCard, "TARCREDI", "CODIGO", clientPoco.TARTI); store.AddParamCount(QueryType.QueryChannel, "CANAL", "CODIGO", clientPoco.CANAL); store.AddParamCount(QueryType.QueryCompany, "SUBLICEN", "CODIGO", clientPoco.SUBLICEN); store.AddParamCount(QueryType.QueryOffice, "OFICINAS", "CODIGO", clientPoco.OFICINA); store.AddParamCount(QueryType.QueryPaymentForm, "FORMAS", "CODIGO", ValueToString(clientPoco.FPAGO)); store.AddParamCount(QueryType.QuerySeller, "VENDEDOR", "NUM_VENDE", clientPoco.VENDEDOR); store.AddParamCount(QueryType.QueryActivity, "ACTIVI", "NUM_ACTIVI", clientPoco.SECTOR); store.AddParamCount(QueryType.QueryOrigin, "ORIGEN", "NUM_ORIGEN", ValueToString(clientPoco.ORIGEN)); store.AddParamCount(QueryType.QueryBusiness, "NEGOCIO", "CODIGO", clientPoco.NEGOCIO); store.AddParamCount(QueryType.QueryInvoiceBlocks, "BLOQUEFAC", "CODIGO", clientPoco.BLOQUEFAC); store.AddParamCount(QueryType.QueryBudgetKey, "CLAVEPTO", "COD_CLAVE", clientPoco.CLAVEPTO); store.AddParamCount(QueryType.QueryClientSummary, "CLIENTES1", "NUMERO_CLI", clientPoco.CLIENTEFAC); store.AddParamCount(QueryType.QueryCommissionAgentSummaryById, "COMISIO", "NUM_COMI", clientPoco.COMISIO); store.AddParamCount(QueryType.QueryClientDelegations, "CliDelega", "cldIdCliente", clientPoco.NUMERO_CLI); store.AddParamCount(QueryType.QueryClientContacts, "CliContactos", "ccoIdCliente", clientPoco.NUMERO_CLI); store.AddParamCount(QueryType.QueryRentingUse, "USO_ALQUILER", "CODIGO", ValueToString(clientPoco.USO_ALQUILER)); return(store); }
public override void MyTestCleanup() { File.Delete(_tempFileStorepath); _tempFileStorepath = string.Empty; Writer = null; Reader = null; }
public TerminalPredicate GetExecutionPredicate(IQueryStore queryStore) { if (_predicates.Count == 1) { return(_predicates[0].GetExecutionPredicate(queryStore)); } bool optimized = true; ORPredicate orPredicate = new ORPredicate(); foreach (var predicate in _predicates) { TerminalPredicate execPred = predicate.GetExecutionPredicate(queryStore); if (execPred is StorePredicate) { optimized = false; break; } orPredicate.AddChildPredicate(execPred); } if (!optimized) { return(new StorePredicate(OrTreePredicate, queryStore)); } return(orPredicate); }
public async Task <IEnumerable <ContractSummaryDto> > GetPagedSummaryDoAsync(int offset, int pageSize) { IQueryStore store = QueryStoreFactory.GetQueryStore(); var list = new List <string>(); list.Add(pageSize.ToString()); list.Add(offset.ToString()); var query = store.BuildQuery(QueryType.QueryContractSummaryPaged, list); var result = new List <ContractSummaryDto>(); using (var conn = SqlExecutor.OpenNewDbConnection()) { if (conn == null) { return(result); } var resultValues = await conn?.QueryAsync <ContractSummaryDto>(query); if (resultValues != null) { return(resultValues); } } // safe default in case of error. return(new List <ContractSummaryDto>()); }
private IQueryStore CreateQueryStore(SupplierPoco queryResult) { // QueryType.QuerySuppliersBranches, code IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParamCount(QueryType.QuerySuppliersBranches, "ProDelega", "ccoIdCliente", queryResult.NUM_PROVEE); store.AddParamCount(QueryType.QuerySuppliersContacts, "ProContactos", "ccoIdCliente", queryResult.NUM_PROVEE); store.AddParamCount(QueryType.QueryProvince, queryResult.PROV); store.AddParamCount(QueryType.QueryCity, queryResult.POBLACION); store.AddParamCount(QueryType.QueryAccount, queryResult.CUGASTO); store.AddParamCount(QueryType.QueryAccount, queryResult.CONTABLE); store.AddParamCount(QueryType.QueryAccount, queryResult.RETENCION); store.AddParamCount(QueryType.QueryAccount, queryResult.CTAPAGO); store.AddParamCount(QueryType.QueryAccount, queryResult.CTALP); store.AddParamCount(QueryType.QueryAccount, queryResult.CTACP); store.AddParamCount(QueryType.QueryAccount, queryResult.CTAINTRACOP); store.AddParamCount(QueryType.QueryAccount, queryResult.ctaintracoPRep); store.AddParamCount(QueryType.QueryLanguage, "IDIOMAS", "CODIGO", queryResult.IDIOMA); store.AddParamCount(QueryType.QueryCountry, "PAIS", "SIGLAS", queryResult.PAIS_DEVO); store.AddParamCount(QueryType.QueryCountry, "PAIS", "SIGLAS", queryResult.PAIS_PAGO); store.AddParamCount(QueryType.QueryCountry, "PAIS", "SIGLAS", queryResult.PAIS_RECLAMA); store.AddParamCount(QueryType.QueryOffice, queryResult.OFICINA); store.AddParamCount(QueryType.QueryCompany, queryResult.SUBLICEN); store.AddParamCount(QueryType.QueryCurrency, queryResult.DIVISA); store.AddParamCount(QueryType.QueryDeliveringFrom, ValueToString(queryResult.FORMA_ENVIO)); return(store); }
/// <summary> /// Load asynchronous values. /// </summary> /// <param name="code">Code to be used</param> /// <returns>An office data transfer object</returns> public async Task <OfficeDtos> LoadValueAsync(string code) { OfficeDtos officeDtos = new OfficeDtos(); using (IDbConnection connection = _executor.OpenNewDbConnection()) { var value = await connection.GetAsync <OFICINAS>(code); officeDtos = _mapper.Map <OFICINAS, OfficeDtos>(value); if (value != null) { IQueryStore queryStore = _queryStoreFactory.GetQueryStore(); queryStore.AddParam(QueryType.QueryCurrency); queryStore.AddParam(QueryType.HolidaysByOffice, value.CODIGO); var queryHolidays = queryStore.BuildQuery(); var reader = await connection.QueryMultipleAsync(queryHolidays); var offices = reader.Read <CURRENCIES>(); if (!reader.IsConsumed) { var holidaysByOffice = reader.Read <FESTIVOS_OFICINA>(); officeDtos.HolidayDates = _mapper.Map <IEnumerable <FESTIVOS_OFICINA>, IEnumerable <HolidayDto> >(holidaysByOffice); } } } return(officeDtos); }
/// <summary> /// Retrieve the list of all commission agents and convert them in a data transfer object list. /// </summary> /// <returns>The list of commission agents</returns> public async Task <IEnumerable <CommissionAgentSummaryDto> > GetCommissionAgentSummaryDo() { IEnumerable <CommissionAgentSummaryDto> summary = new ObservableCollection <CommissionAgentSummaryDto>(); IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParam(QueryType.QueryCommissionAgentSummary); var query = store.BuildQuery(); using (IDbConnection connection = _sqlExecutor.OpenNewDbConnection()) { try { using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { summary = await connection.QueryAsync <CommissionAgentSummaryDto>(query).ConfigureAwait(false); } } catch (System.Exception ex) { throw new DataLayerException("CommissionAgentLoadException", ex); } finally { connection.Close(); } } return(summary); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { container.Bind<IBusiness, DataBusiness>(); queryStore.ConnectionString = new Crow.Library.Foundation.Common.ConnectionStringInformation("Data Source=.;Initial Catalog=Test;User Id=sa;Password=Aa123456"); queryStore.Expression<IDataRepository, Data>("GetDataById").Where<int>((m, id) => m.Id == id).AddToStore(); }
public override void MyTestCleanup() { Directory.Delete(_tempFileStorepath, true); _tempFileStorepath = string.Empty; Writer = null; Reader = null; }
private IQueryStore CreateQueryStore(OFICINAS office) { IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParam(QueryType.QueryCity, office.CP); store.AddParam(QueryType.QueryOfficeZone, office.ZONAOFI); return(store); }
public UserEventSubscriber(IEventQueue queue, IQueryStore store) { queue.Subscribe <UserRegistrationStarted>(Handle); queue.Subscribe <UserRegistrationSucceeded>(Handle); queue.Subscribe <UserRegistrationFailed>(Handle); _store = store; }
public PersonEventSubscriber(IEventQueue queue, IQueryStore store) { _store = store; queue.Subscribe <PersonBoxed>(Handle); queue.Subscribe <PersonRegistered>(Handle); queue.Subscribe <PersonRenamed>(Handle); queue.Subscribe <PersonUnboxed>(Handle); }
public TransferEventSubscriber(IEventQueue queue, IQueryStore store, IQuerySearch search) { queue.Subscribe <TransferStarted>(Handle); queue.Subscribe <TransferUpdated>(Handle); queue.Subscribe <TransferCompleted>(Handle); _store = store; _search = search; }
public void SetUp() { this.eventStore = new EventStore( new LocalEventStore(), new Mock <IEventStoreBus>().Object, EventStoreSerializer.FromAggregateTypes(typeof(Sample.Counter))); this.queryStore = new LocalQueryStore <CounterStats>(); }
public void SetUp() { this.eventStore = new EventStore( new LocalEventStore(), new Mock<IEventStoreBus>().Object, EventStoreSerializer.FromAggregateTypes(typeof(Sample.Counter))); this.queryStore = new LocalQueryStore<CounterStats>(); }
/// <summary> /// This saves the holiday in the office. /// </summary> /// <param name="currentOffice">Current office to be saved.</param> /// <param name="holidayDto">List of vacation for the current office.</param> /// <returns>return a task for saving the holidays</returns> private async Task <bool> SaveHolidayOfficeAsync(IDbConnection connection, OFICINAS currentOffice, IEnumerable <HolidayDto> holidayDto) { Contract.Requires(connection != null, "Connection is not null"); Contract.Requires(currentOffice != null, "Current office is not null"); Contract.Requires(holidayDto != null, "HolidayDto is not null"); if (currentOffice.CODIGO == null) { throw new ArgumentNullException("Office code is null"); } if (holidayDto.Count() == 0) { return(true); } IEnumerable <FESTIVOS_OFICINA> holidayOffice = _mapper.Map <IEnumerable <HolidayDto>, IEnumerable <FESTIVOS_OFICINA> >(holidayDto); IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParam(QueryType.HolidaysByOffice, currentOffice.CODIGO); var query = store.BuildQuery(); bool saved = false; // First i want fetch the current festivo oficina. // we shall insert or merge. try { var currentHolidays = await connection.QueryAsync <FESTIVOS_OFICINA>(query); var festivosOficinas = currentHolidays as FESTIVOS_OFICINA[] ?? currentHolidays.ToArray(); if (!festivosOficinas.Any()) { saved = await connection.InsertAsync(holidayOffice).ConfigureAwait(false) > 0; } else { // divide what to be inserted from what we should update. var holidayValues = DistintSelect(currentHolidays, holidayOffice); var value = holidayValues.Item2.ToList(); if (holidayValues.Item2.Any()) { saved = await connection.InsertAsync(holidayValues.Item2).ConfigureAwait(false) > 0; } if (holidayValues.Item1.Any()) { saved = saved && await connection.UpdateAsync(holidayValues.Item1).ConfigureAwait(false); } } } catch (System.Exception e) { connection.Close(); connection.Dispose(); throw new DataLayerException(e.Message, e); } return(saved); }
public static bool Exists <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, WhereClauseResult whereClause) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.Exists(conn, whereClause, null)); }
public static Task <IEnumerable <TEntity> > TakeAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, int take, IEnumerable <Expression <Func <TEntity, object> > > selectFields, IDbTransaction tr, CancellationToken cancellationToken) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.TakeAsync(conn, take, selectFields, WhereClauseResult.Null, OrderbyClauseResult.Null, tr, cancellationToken)); }
public static Task <IEnumerable <TEntity> > TakeAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, int take, WhereClauseResult whereClause, OrderbyClauseResult orderbyClause, IDbTransaction tr) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.TakeAsync(conn, take, null, whereClause, orderbyClause, tr, default(CancellationToken))); }
public static Task <TEntity> SingleOrDefaultAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, Expression <Func <TEntity, object> > id, TKey value, IDbTransaction tr, CancellationToken cancellationToken) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.SingleOrDefaultAsync(conn, null, id, value, tr, cancellationToken)); }
public static Task <TEntity> SingleOrDefaultAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, TKey value, CancellationToken cancellationToken) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.SingleOrDefaultAsync(conn, null, _ => _.Id, value, null, cancellationToken)); }
public static Task <TEntity> SingleOrDefaultAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, IEnumerable <Expression <Func <TEntity, object> > > selectFields, TKey value) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.SingleOrDefaultAsync(conn, selectFields, _ => _.Id, value, null, default(CancellationToken))); }
public static Task <TEntity> FirstOrDefaultAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, IDbTransaction tr, CancellationToken cancellationToken) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.FirstOrDefaultAsync(conn, null, WhereClauseResult.Null, OrderbyClauseResult.Null, tr, cancellationToken)); }
public static IEnumerable <TEntity> Take <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, int take, OrderbyClauseResult orderbyClause, IDbTransaction tr) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.Take(conn, take, null, WhereClauseResult.Null, orderbyClause, tr)); }
public static IEnumerable <TEntity> Take <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, int take, IEnumerable <Expression <Func <TEntity, object> > > selectFields) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.Take(conn, take, selectFields, WhereClauseResult.Null, OrderbyClauseResult.Null, null)); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { container.Bind<IHttpHost, AspNetSelfHosting>(); container.Bind<ICrowHttpHandler, HttpCrowDispatcher>(); container.Bind<INamingConvention, DefaultNamingConvention>(); container.Bind<ICrow, CrowDocumentationController>(); container.Bind<ICrowHttpHost, CrowHost>(); container.Bind<IHostConfiguration, HostConfiguration>(); container.Bind<IBusinessControllerSelector, CrowBusinessControllerSelector>(); }
public static Task <TEntity> FirstOrDefaultAsync <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, IEnumerable <Expression <Func <TEntity, object> > > selectFields) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.FirstOrDefaultAsync(conn, selectFields, WhereClauseResult.Null, OrderbyClauseResult.Null, null, default(CancellationToken))); }
public static IEnumerable <TEntity> Select <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, IEnumerable <Expression <Func <TEntity, object> > > selectFields, OrderbyClauseResult orderbyClause, IDbTransaction tr) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.Select(conn, selectFields, WhereClauseResult.Null, orderbyClause, tr)); }
/// <summary> /// Create a local query store. /// </summary> /// <param name="company">Company data transfer object used to be inserted in the query store.</param> /// <returns>Return an interface of the query store.</returns> private IQueryStore CreateQueryStore(CompanyDto company) { IQueryStore store = _queryStoreFactory.GetQueryStore(); store.AddParam(QueryType.QueryCity, company.City.Code); store.AddParam(QueryType.QueryCountry, company.Country.Code); store.AddParam(QueryType.QueryProvince, company.Province.Code); store.AddParam(QueryType.QueryOffice, company.Code); return(store); }
public static IEnumerable <TEntity> Select <TKey, TEntity>(this IQueryStore <TKey, TEntity> queryStore, IStorageDbConnection conn, OrderbyClauseResult orderbyClause) where TKey : IEquatable <TKey> where TEntity : class, IEntity <TKey> { if (queryStore == null) { throw new ArgumentNullException(nameof(queryStore)); } return(queryStore.Select(conn, null, WhereClauseResult.Null, orderbyClause, null)); }
public AccountEventSubscriber(IEventQueue queue, IQueryStore store, IQuerySearch search) { queue.Subscribe <AccountOpened>(Handle); queue.Subscribe <AccountClosed>(Handle); queue.Subscribe <MoneyDeposited>(Handle); queue.Subscribe <MoneyWithdrawn>(Handle); _store = store; _search = search; }
public void Install(IInjectionContainer container, IQueryStore queryStore) { string provider = "System.Data.SqlClient"; string connectionString = "Data Source=.;Initial Catalog=Test;User Id=sa;Password=Aa123456"; queryStore.ConnectionString = new ConnectionStringInformation(connectionString, provider); queryStore.Expression<IDataRepository, Data>("LoadDataById") .Select() .Where<int>((data, id) => data.Id == id) .OrderBy((d) => d.Id) .AddToStore(); container.Bind<IDataBusiness, DataBusinessClass>(); }
/// <summary> /// Installs the crow components. /// </summary> /// <param name="container"></param> /// <param name="queryStore"></param> public void Install(IInjectionContainer container, IQueryStore queryStore) { container.Bind<ILog, DefaultLogger>(); container.Bind<IFileOperations, FSFileOperations>(); container.Bind<IConfigurationHelper, ApplicationConfigurationHelper>(); container.Bind<IMessagingService, DebugMessagesService>(); container.Bind<IAccountService, UnsafeAccountService>(); container.Bind<IDialectProvider, SqlDialectProvider>(); container.Bind<ICacheManager, InMemoryCacheManager>(); container.Bind<ITemplateEngine, PoorMansTemplating>(); container.Bind<IAssemblyLoader, FileAssemblyLoader>(); container.Bind<IItemManager, ThreadItemManager>(); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { _isInstalled = true; installerstack.Push("Child"); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { installerstack.Push("Parent"); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { container.Bind<IFakeUserBusiness, FakeUserBusiness>(); }
public void Install(IInjectionContainer container, IQueryStore queryStore) { container.Bind<ITestBusiness, TestBusiness>(); }