public Repository(IDbConnection dbConnection, ISqlQueries sqlQueries, string name) { _dbConnection = dbConnection; _sqlQueries = sqlQueries; _name = name; if (_dbConnection.State != ConnectionState.Open) { _dbConnection.Open(); } }
public ScoreDetailsViewModel(IRunsCalculatorLogic RunsCalculatorLogic, ILoadRepository LoadRepository, IEventAggregator eventAggregator, IDataReaderLogic DataReaderLogic, ISqlQueries SqlQueries) { dataReaderLogic = DataReaderLogic; runsCalculatorLogic = RunsCalculatorLogic; loadRepository = LoadRepository; _eventAggregator = eventAggregator; sqlQueries = SqlQueries; _eventAggregator.GetEvent <MatchNoEvent>().Subscribe(MatchNoReceived); CalculateScoreDelegateCommand = new DelegateCommand(Execute, CanExecute); GoBackDelegateCommand = new DelegateCommand(GoBack); FPLTeamDelegateCommand = new DelegateCommand(GetFPLTeamPoints); FPLTeamLists = dataReaderLogic.GetAllFPLTeam(); }
/// <summary> /// Selects the rows with the given keys. /// </summary> /// <typeparam name="T">The table type.</typeparam> /// <typeparam name="KeyType">The key type.</typeparam> /// <param name="connection">The connection to query on.</param> /// <param name="whereExpr">The where condition to use for this query.</param> /// <param name="transaction">The transaction to use for this query.</param> /// <param name="buffered">Whether to buffer the results in memory.</param> /// <param name="commandTimeout">Number of seconds before command execution timeout.</param> /// <returns>The keys that match the given condition.</returns> public static IEnumerable <KeyType> GetKeys <T, KeyType>(this IDbConnection connection, Expression <Func <T, bool> > whereExpr, IDbTransaction transaction = null, bool buffered = true, int commandTimeout = 30) where T : class { ISqlQueries <T> queries = ExtraCrud.Queries <T>(); WhereConditionData <T> data = queries.Compile(whereExpr); IEnumerable <object> keys = queries.GetKeysKeys(connection, data.WhereCondition, data.Param, transaction, buffered, commandTimeout); if (typeof(KeyType) == typeof(long)) { if (keys.Any()) { Type type = keys.First().GetType(); if (type == typeof(int)) { keys = keys.Select(k => (object)(long)(int)k); } } } IEnumerable <KeyType> castedKeys = keys.Select(k => (KeyType)k); return(castedKeys); }
public EmployeesRepository(IDbConnection connection, ISqlQueries sqlQueries) : base(connection, sqlQueries, nameof(EmployeesRepository)) { }
public UnitOfWork(IConfiguration configuration, ISqlQueries sqlQueries) { _configuration = configuration; _sqlQueries = sqlQueries; _connection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection")); }
public AggregateCountryPopulation(IStatService statService, ISqlQueries sql) { this.statService = statService; this.sql = sql; }
public SqlConnectionInjector(ISqlQueries <T> sql) => Sql = sql;
public UserRepository(DefaultContext context, IDbConnection connection, ISqlQueries sqlQueries) : base(context, connection, sqlQueries, "User") { }
/// <summary> /// Creates or gets the queries and commands for a given type. /// </summary> /// <typeparam name="T">The table type.</typeparam> /// <returns>The queries for the given type.</returns> public static ISqlQueries <T> Queries <T>() where T : class { ISqlQueries <T> queries = Builder <T>().Queries; return(queries); }
public DashboardRepository(DefaultContext context, IDbConnection connection, ISqlQueries sqlQueries) : base(context, connection, sqlQueries, "UserChecklist") { }