public static string GetDocLocation(IMInstance iMInstance, string engNum, double docNum) { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (var db = new IMDbContext(iMInstance)) { var docLoc = db.Set<DOCMASTER>(). Where(x => x.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase) && x.DOCNUM == docNum && x.VERSION == 1 ).Select(y => y.DOCLOC).ToList().FirstOrDefault(); var sp_docLoc = docLoc.Split(':'); var p1 = sp_docLoc[0].Trim(); var srvLoc = db.Set<DOCSERVER>(). Where(x => x.DOCSERVER1.Equals(p1, StringComparison.OrdinalIgnoreCase) ).Select(y => y.LOCATION).ToList().FirstOrDefault(); var result = string.Format("{0}{1}", srvLoc, sp_docLoc[1]); return result; } } }
public static string GetDocLocation(IMInstance iMInstance, string engNum, double docNum) { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (var db = new IMDbContext(iMInstance)) { var docLoc = db.Set <DOCMASTER>(). Where(x => x.C2ALIAS.Equals(engNum, StringComparison.OrdinalIgnoreCase) && x.DOCNUM == docNum && x.VERSION == 1 ).Select(y => y.DOCLOC).ToList().FirstOrDefault(); var sp_docLoc = docLoc.Split(':'); var p1 = sp_docLoc[0].Trim(); var srvLoc = db.Set <DOCSERVER>(). Where(x => x.DOCSERVER1.Equals(p1, StringComparison.OrdinalIgnoreCase) ).Select(y => y.LOCATION).ToList().FirstOrDefault(); var result = string.Format("{0}{1}", srvLoc, sp_docLoc[1]); return(result); } } }
private static dynamic GetWsId(IMInstance iMInstance, List <string> engNums) { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (var db = new IMDbContext(iMInstance)) { var result = ( from dm in db.Set <DOCMASTER>() join prj in db.Set <PROJECT>() on dm.DOCNUM equals prj.DOCNUM where engNums.Contains(dm.C2ALIAS) && dm.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase) && dm.DOCNAME.Equals("", StringComparison.OrdinalIgnoreCase) select new { EngNum = dm.C2ALIAS, EngId = prj.PRJ_ID }).ToList(); return(result); } } }
public Movie GetMovieById(Guid id) { return(_context.Set <Movie>() .Where(x => x.Id.Equals(id)) .Include(x => x.CastOfMovies) .ThenInclude(x => x.Cast) .AsNoTracking() .FirstOrDefault()); }
/// <summary> /// Returns a list of users ordered by name with pagination. /// </summary> /// <param name="predicate"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <returns></returns> public Pagination <User> GetUsersWithPagination( Expression <Func <User, bool> > predicate, int pageNumber, int pageSize) { var query = _context.Set <User>() .Include(x => x.Role) .OrderBy(x => x.Name) .AsNoTracking(); var skipNumber = Pagination <User> .CalculateSkipNumber(pageNumber, pageSize); var totalItemCount = query.Where(predicate).Count(); var users = query.Where(predicate).Skip(skipNumber).Take(pageSize).ToList(); return(new Pagination <User> ( items: users, totalItemCount: totalItemCount, pageSize: pageSize, currentPage: pageNumber )); }
protected Repository(IMDbContext db) { _db = db; _dbSet = _db.Set <TEntity>(); }
public IEnumerable <TEntity> GetAll() { return(_context.Set <TEntity>() .AsNoTracking() .ToList()); }
public BaseRepository(IMDbContext context, AuthenticatedUser user) { _context = context; _dbSet = context.Set <TEntity>(); _user = user; }
private static dynamic GetWsId(IMInstance iMInstance, List<string> engNums) { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (var db = new IMDbContext(iMInstance)) { var result = ( from dm in db.Set<DOCMASTER>() join prj in db.Set<PROJECT>() on dm.DOCNUM equals prj.DOCNUM where engNums.Contains(dm.C2ALIAS) && dm.C_ALIAS.Equals("WEBDOC", StringComparison.OrdinalIgnoreCase) && dm.DOCNAME.Equals("", StringComparison.OrdinalIgnoreCase) select new { EngNum = dm.C2ALIAS, EngId = prj.PRJ_ID }).ToList(); return result; } } }