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;
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        /// <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>()
                                  ));
        }