public Task AddAsync(UserSignalsInsertDeleteOptions insertOptions) { string rowKey = BuildRowKey(insertOptions.UserId, insertOptions.Signal); BoundStatement boundStatement = _insertStatement.Value.Bind(rowKey, insertOptions.DateTime, insertOptions.ItemId); return(_session.Get().ExecuteAsync(boundStatement)); }
public AffinityGroupItemCountsRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(AffinityGroupItemCountsEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName <AffinityGroupItemCountsEntity>(x => x.AffinityGroupSignalType); string itemIdPropertyName = NameOfHelper.PropertyName <AffinityGroupItemCountsEntity>(x => x.ItemId); string countPropertyName = NameOfHelper.PropertyName <AffinityGroupItemCountsEntity>(x => x.Count); _getByIdStatement = new Lazy <PreparedStatement>(() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" = ?", entityName, rowKeyPropertyName, itemIdPropertyName))); _getStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); _incStatement = new Lazy <PreparedStatement>( () => _session.Get() .Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" + 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName))); _decStatement = new Lazy <PreparedStatement>( () => _session.Get() .Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" - 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName))); }
public AffinityGroupItemCountsRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (AffinityGroupItemCountsEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.AffinityGroupSignalType); string itemIdPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.ItemId); string countPropertyName = NameOfHelper.PropertyName<AffinityGroupItemCountsEntity>(x => x.Count); _getByIdStatement = new Lazy<PreparedStatement>(() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" = ?", entityName, rowKeyPropertyName, itemIdPropertyName))); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); _incStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" + 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName))); _decStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" - 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, itemIdPropertyName))); }
public Task AddHourlyAsync(TimeSeriesRawInsertOptions options) { string rowKey = BuildRowKey(options.EventId, options.DateTime); BoundStatement boundStatement = _insertStatement.Value.Bind(rowKey, options.DateTime, options.Payload); return(_session.Get().ExecuteAsync(boundStatement)); }
public AffinityGroupMostSignaledRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (AffinityGroupMostSignaledEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<AffinityGroupMostSignaledEntity>(x => x.AffinityGroupSignalType); string countPropertyName = NameOfHelper.PropertyName<AffinityGroupMostSignaledEntity>(x => x.Count); string itemIdPropertyName = NameOfHelper.PropertyName<AffinityGroupMostSignaledEntity>(x => x.ItemId); _insertStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\") VALUES(?,?,?)", entityName, rowKeyPropertyName, countPropertyName, itemIdPropertyName))); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? ORDER BY \"{2}\" DESC", entityName, rowKeyPropertyName, countPropertyName))); _deleteStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("DELETE FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); }
public AffinityGroupMostSignaledRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(AffinityGroupMostSignaledEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName <AffinityGroupMostSignaledEntity>(x => x.AffinityGroupSignalType); string countPropertyName = NameOfHelper.PropertyName <AffinityGroupMostSignaledEntity>(x => x.Count); string itemIdPropertyName = NameOfHelper.PropertyName <AffinityGroupMostSignaledEntity>(x => x.ItemId); _insertStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\") VALUES(?,?,?)", entityName, rowKeyPropertyName, countPropertyName, itemIdPropertyName))); _getStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? ORDER BY \"{2}\" DESC", entityName, rowKeyPropertyName, countPropertyName))); _deleteStatement = new Lazy <PreparedStatement>( () => _session.Get() .Prepare(string.Format("DELETE FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); }
static List <DateTime> GetMissingWeatherDatesForNode(WeatherNode node, DateTime startDate, DateTime endDate) { var latitude = node.Latitude; var longitude = node.Longitude; var dailyReports = _session.Get <WeatherDaily>(x => x.Latitude == latitude && x.Longitude == longitude).ToList(); var missingDates = new List <DateTime>(); var isWesternHemisphere = node.Longitude <= 0; var tzOffsetMin = isWesternHemisphere ? -2 : -14; var tzOffsetMax = isWesternHemisphere ? 14 : 2; //Or "when is 12:00 AM at this location, relative to UTC?" for (DateTime date = startDate.Date; date <= endDate.Date; date = date.AddDays(1)) { var timestamp = TimeConversion.ConvertToTimestamp(date); var tzOffsetMinTime = TimeConversion.ConvertToTimestamp(date.AddHours(tzOffsetMin)); var tzOffsetMaxTime = TimeConversion.ConvertToTimestamp(date.AddHours(tzOffsetMax)); if (!dailyReports.Any(x => x.Time >= tzOffsetMinTime && x.Time <= tzOffsetMaxTime)) { var tzOffsetForDate = TimeConversion.GetTimezoneOffsetFromLocationAndDateInSeconds(timestamp, node.Latitude, node.Longitude); missingDates.Add(date.AddSeconds(-tzOffsetForDate)); } } return(missingDates); }
public ItemSignalsRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (ItemSignalsEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<ItemSignalsEntity>(x => x.ItemIdSignalType); string isAnticolumnPropertyName = NameOfHelper.PropertyName<ItemSignalsEntity>(x => x.IsAnticolumn); string userIdPropertyName = NameOfHelper.PropertyName<ItemSignalsEntity>(x => x.UserId); string dateTimePropertyName = NameOfHelper.PropertyName<ItemSignalsEntity>(x => x.DateTime); _insertStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\",\"{4}\") VALUES(?,false,?,?)", entityName, rowKeyPropertyName, isAnticolumnPropertyName, userIdPropertyName, dateTimePropertyName))); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" = ?", entityName, rowKeyPropertyName, isAnticolumnPropertyName))); _deleteStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\",\"{4}\") VALUES(?,true,?,?)", entityName, rowKeyPropertyName, isAnticolumnPropertyName, userIdPropertyName, dateTimePropertyName))); }
public async Task <IEnumerable <TimeSeriesRollupsDayEntity> > GetSequenceAsync(string eventId, DateTime fromTime, DateTime toTime, int pageSize) { BoundStatement boundStatement = _getStatement.Value.Bind(eventId, fromTime, toTime); // setting properties boundStatement.SetPageSize(pageSize); RowSet rowset = await _session.Get().ExecuteAsync(boundStatement); return(rowset.Select(r => _mapper.Map <Row, TimeSeriesRollupsDayEntity>(r))); }
public virtual IHttpActionResult GetAtTime(int latitude, int longitude, long time) { var range = TimeConversion.GetDailyTimestampRange(time, longitude); var dailyResult = _session.Get <T>(x => x.Latitude == latitude && x.Longitude == longitude && x.Time >= range.Item1 && x.Time <= range.Item2 ).FirstOrDefault(); return(Ok(dailyResult)); }
public Task AddAsync(string groupId, SignalType signal, long version, List <AffinityGroupMostSignaledInsertOptions> options) { string rowKey = BuildRowKey(groupId, signal, version); var batch = new BatchStatement(); foreach (var option in options) { BoundStatement boundStatement = _insertStatement.Value.Bind(rowKey, option.Count, option.ItemId); batch.Add(boundStatement); } return(_session.Get().ExecuteAsync(batch.SetConsistencyLevel(ConsistencyLevel.One))); }
public UserCountsRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(UserCountsEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string userIdPropertyName = NameOfHelper.PropertyName <UserCountsEntity>(x => x.UserId); string likesPropertyName = NameOfHelper.PropertyName <UserCountsEntity>(x => x.Likes); string dislikesPropertyName = NameOfHelper.PropertyName <UserCountsEntity>(x => x.Dislikes); string viewsPropertyName = NameOfHelper.PropertyName <UserCountsEntity>(x => x.Views); string abusesPropertyName = NameOfHelper.PropertyName <UserCountsEntity>(x => x.Abuses); _getStatement = new Lazy <PreparedStatement>(() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, userIdPropertyName))); _incViewsStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, viewsPropertyName))); _incLikesStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, likesPropertyName))); _incDislikesStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, dislikesPropertyName))); _decLikesStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" - 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, likesPropertyName))); _decDislikesStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" - 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, dislikesPropertyName))); _incAbuseStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, abusesPropertyName))); }
public UserCountsRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (UserCountsEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string userIdPropertyName = NameOfHelper.PropertyName<UserCountsEntity>(x => x.UserId); string likesPropertyName = NameOfHelper.PropertyName<UserCountsEntity>(x => x.Likes); string dislikesPropertyName = NameOfHelper.PropertyName<UserCountsEntity>(x => x.Dislikes); string viewsPropertyName = NameOfHelper.PropertyName<UserCountsEntity>(x => x.Views); string abusesPropertyName = NameOfHelper.PropertyName<UserCountsEntity>(x => x.Abuses); _getStatement = new Lazy<PreparedStatement>(() => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, userIdPropertyName))); _incViewsStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, viewsPropertyName))); _incLikesStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, likesPropertyName))); _incDislikesStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, dislikesPropertyName))); _decLikesStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" - 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, likesPropertyName))); _decDislikesStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" - 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, dislikesPropertyName))); _incAbuseStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{2}\" = \"{2}\" + 1 WHERE \"{1}\" = ?", entityName, userIdPropertyName, abusesPropertyName))); }
public AffinityGroupMostSignaledVersionRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(AffinityGroupMostSignaledVersionEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName <AffinityGroupMostSignaledVersionEntity>(x => x.AffinityGroupSignalType); string versionPropertyName = NameOfHelper.PropertyName <AffinityGroupMostSignaledVersionEntity>(x => x.Version); _updateStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = ? WHERE \"{2}\" = ?", entityName, versionPropertyName, rowKeyPropertyName))); _getStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); }
public AffinityGroupMostSignaledVersionRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (AffinityGroupMostSignaledVersionEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<AffinityGroupMostSignaledVersionEntity>(x => x.AffinityGroupSignalType); string versionPropertyName = NameOfHelper.PropertyName<AffinityGroupMostSignaledVersionEntity>(x => x.Version); _updateStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = ? WHERE \"{2}\" = ?", entityName, versionPropertyName, rowKeyPropertyName))); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ?", entityName, rowKeyPropertyName))); }
public async Task <AffinityGroupCountsEntity> GetAsync(string groupId, SignalType signal) { string rowId = BuildRowKey(groupId, signal); BoundStatement boundStatement = _getStatement.Value.Bind(rowId); RowSet rowset = await _session.Get().ExecuteAsync(boundStatement); List <Row> rows = rowset.ToList(); if (rows.Count == 0) { return(new AffinityGroupCountsEntity { AffinityGroupSignalType = rowId }); } Row row = rows.First(); return(_mapper.Map <Row, AffinityGroupCountsEntity>(row)); }
public TimeSeriesRawRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(TimeSeriesRawEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName <TimeSeriesRawEntity>(x => x.EventIdYymmddhh); string dateTimePropertyName = NameOfHelper.PropertyName <TimeSeriesRawEntity>(x => x.DateTime); string payloadPropertyName = NameOfHelper.PropertyName <TimeSeriesRawEntity>(x => x.Payload); _insertStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\") VALUES(?,?,?)", entityName, rowKeyPropertyName, dateTimePropertyName, payloadPropertyName))); _getStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" >= ? AND \"{2}\" <= ?", entityName, rowKeyPropertyName, dateTimePropertyName))); }
public TimeSeriesRawRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (TimeSeriesRawEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<TimeSeriesRawEntity>(x => x.EventIdYymmddhh); string dateTimePropertyName = NameOfHelper.PropertyName<TimeSeriesRawEntity>(x => x.DateTime); string payloadPropertyName = NameOfHelper.PropertyName<TimeSeriesRawEntity>(x => x.Payload); _insertStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("INSERT INTO \"{0}\" (\"{1}\",\"{2}\",\"{3}\") VALUES(?,?,?)", entityName, rowKeyPropertyName, dateTimePropertyName, payloadPropertyName))); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" >= ? AND \"{2}\" <= ?", entityName, rowKeyPropertyName, dateTimePropertyName))); }
public TimeSeriesRollupsDayRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof (TimeSeriesRollupsDayEntity).GetCustomAttributes(typeof (TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName<TimeSeriesRollupsDayEntity>(x => x.EventId); string dayPropertyName = NameOfHelper.PropertyName<TimeSeriesRollupsDayEntity>(x => x.Day); string countPropertyName = NameOfHelper.PropertyName<TimeSeriesRollupsDayEntity>(x => x.Count); _getStatement = new Lazy<PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" >= ? AND \"{2}\" <= ?", entityName, rowKeyPropertyName, dayPropertyName))); _incStatement = new Lazy<PreparedStatement>( () => _session.Get() .Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" + 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, dayPropertyName))); }
public TimeSeriesRollupsMinuteRepository(ICassandraSession session, IMapper mapper) { _session = session; _mapper = mapper; // Preparing statements TableAttribute tableAttribute = typeof(TimeSeriesRollupsMinuteEntity).GetCustomAttributes(typeof(TableAttribute), true).Select(a => (TableAttribute)a).First(); string entityName = tableAttribute.Name; string rowKeyPropertyName = NameOfHelper.PropertyName <TimeSeriesRollupsMinuteEntity>(x => x.EventIdHh); string minutePropertyName = NameOfHelper.PropertyName <TimeSeriesRollupsMinuteEntity>(x => x.Minute); string countPropertyName = NameOfHelper.PropertyName <TimeSeriesRollupsMinuteEntity>(x => x.Count); _getStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("SELECT * FROM \"{0}\" WHERE \"{1}\" = ? AND \"{2}\" >= ? AND \"{2}\" <= ?", entityName, rowKeyPropertyName, minutePropertyName))); _incStatement = new Lazy <PreparedStatement>( () => _session.Get().Prepare(string.Format("UPDATE \"{0}\" SET \"{1}\" = \"{1}\" + 1 WHERE \"{2}\" = ? AND \"{3}\" = ?", entityName, countPropertyName, rowKeyPropertyName, minutePropertyName))); }
public async Task <UserCountsEntity> GetAsync(string userId) { BoundStatement boundStatement = _getStatement.Value.Bind(userId); RowSet rowset = await _session.Get().ExecuteAsync(boundStatement); List <Row> rows = rowset.ToList(); if (rows.Count == 0) { return(new UserCountsEntity { UserId = userId }); } Row row = rows.First(); return(_mapper.Map <Row, UserCountsEntity>(row)); }
public virtual IHttpActionResult GetAll() { var nodes = _session.Get <T>(); return(Ok(nodes)); }