public TFSEntity Find(FSSystemGuid rowId) { using (var dataContext = new FSDataContext <TFSEntity>(_provider)) { return(dataContext.GetByRowId(rowId)); } }
public FSIdent(FSSystemGuid rowId, FSlong rowVersion) { Guard.ArgumentNotNull(() => rowId); Guard.ArgumentNotNull(() => rowVersion); RowId = rowId; RowVersion = rowVersion; }
internal T GetByRowId(FSSystemGuid rowId) { var o = Create(); var entityIdColumn = o.GetVirtualColumnNameOnPropertyName("ROWID"); var where = entityIdColumn + DB.SqlStringRowID("=", rowId); if (o.Load(where) != 1) { return(null); } return(o); }
internal async Task <T> GetByRowIdAsync(Guid rowId) { var o = Create(); var entityIdColumn = o.GetVirtualColumnNameOnPropertyName("ROWID"); var where = entityIdColumn + DB.SqlStringRowID("=", FSSystemGuid.FromObject(rowId)); var loadResult = await Task.Run(() => o.Load(where)); if (loadResult != 1) { return(null); } return(o); }
internal T GetByRowId(string rowId) { if (!Guid.TryParse(rowId, out var guid)) { return(null); } var o = Create(); var entityIdColumn = o.GetVirtualColumnNameOnPropertyName("ROWID"); var where = entityIdColumn + DB.SqlStringRowID("=", FSSystemGuid.FromObject(guid)); if (o.Load(where) != 1) { return(null); } return(o); }
/// <summary> /// Gets the by row identifier asynchronous. /// </summary> /// <param name="rowIds">The row ids.</param> /// <returns></returns> internal async Task <IEnumerable <T> > GetByRowIdAsync(IEnumerable <string> rowIds) { var o = Create(); var entityIdColumn = o.GetVirtualColumnNameOnPropertyName("ROWID"); var where = rowIds.Batch(1000) .Select(block => $"{entityIdColumn} IN ({block.Join(",", x => $"'{DB.SqlStringRowID(FSSystemGuid.FromObject(x))}'")})") .Join(" OR "); return(await Task.Run(() => o.GetFetchNext(where) .Cast <T>() )); }