public async Task <IActionResult> Index([Bind("EmployeeId")] EmployeeQuery employeeQuery) { string getEmployeesURL = _configuration.GetSection("Settings").GetSection("WebAPI").GetValue <string>("Url"); string queryString = string.Empty; if (!string.IsNullOrEmpty(employeeQuery.EmployeeId)) { queryString = $"?id={employeeQuery.EmployeeId}"; } getEmployeesURL += $"/api/Employees{queryString}"; using HttpClient client = new HttpClient(); try { var result = await client.GetStringAsync(getEmployeesURL); var apiResult = JsonConvert.DeserializeObject <List <Employee> >(result); var employeeResults = new EmployeeQuery { Employees = apiResult }; return(View(employeeResults)); } catch { return(View(new EmployeeQuery())); } }
// stop cut public RespCutting(IDbName database, int binterfaceId, int beamCounter) { BeamCutQuery = new BeamCutQuery(database); StockQuery = new StockQuery(database); EmployeeQuery = new EmployeeQuery(database); SequenceQuery = new SequenceQuery(database); ScheduleQuery = new ScheduleQuery(database); ComponentQuery = new ComponentQuery(database); try { var bInterface = BeamCutQuery.GetBeamInterfaceById(binterfaceId); if (bInterface == null) { Exception = new RespException(true, "Can not find BInterface", EKB_SYS_REQUEST.BEAM_STOP_CUTTING); return; } bInterface.Finish = true; bInterface.BeamCutCounter = beamCounter; bInterface.StopCutTime = DateTime.Now; if (!BeamCutQuery.UpdateBeamInterface(bInterface)) { Exception = new RespException(true, "Can not update BInterface", EKB_SYS_REQUEST.BEAM_STOP_CUTTING); return; } Exception = new RespException(false, "Stop cutting: OK", EKB_SYS_REQUEST.BEAM_STOP_CUTTING); } catch (Exception e) { Exception = new RespException(true, e.Message, EKB_SYS_REQUEST.BEAM_STOP_CUTTING); } }
public override int Count(EmployeeQuery query) { using (var enumerator = this.ConvertQuery(query).Run()) { return enumerator.Count; } }
public void LeftJoinFourTablesWithWhere() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); EmployeeQuery emp = new EmployeeQuery("e"); EmployeeTerritoryQuery empTerr = new EmployeeTerritoryQuery("et"); TerritoryQuery terr = new TerritoryQuery("t"); TerritoryExQuery terrEx = new TerritoryExQuery("tx"); emp .Select(emp.FirstName, emp.LastName, terr.Description.As("Territory"), terrEx.Notes) .LeftJoin(empTerr) .On(emp.EmployeeID == empTerr.EmpID) .LeftJoin(terr) .On(empTerr.TerrID == terr.TerritoryID) .LeftJoin(terrEx) .On(terr.TerritoryID == terrEx.TerritoryID) .Where(emp.FirstName.Trim().Like("J___")); Assert.IsTrue(collection.Load(emp)); Assert.AreEqual(7, collection.Count); }
public void WhereExistsFalse() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); // EmployeeID is required and will never be NULL EmployeeQuery sq = new EmployeeQuery("s"); sq.es.Distinct = true; sq .Select(sq.EmployeeID) .Where(sq.EmployeeID.IsNull()); // This should produce no results as the // inner query does not exist. EmployeeQuery eq = new EmployeeQuery("e"); eq .Select(eq.EmployeeID, eq.Supervisor) .Where(eq.Exists(sq)); Assert.IsFalse(collection.Load(eq)); }
public void Nested() { OrderCollection collection = new OrderCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); OrderQuery oq = new OrderQuery("o"); CustomerQuery cq = new CustomerQuery("c"); EmployeeQuery eq = new EmployeeQuery("e"); // OrderID and CustID for customers who ordered on the same date // a customer was added, and have a manager whose // last name starts with 'S'. oq.Select( oq.OrderID, oq.CustID ); oq.Where(oq.OrderDate .In( cq.Select(cq.DateAdded) .Where(cq.Manager.In( eq.Select(eq.EmployeeID) .Where(eq.LastName.Like("S%")) ) ) ) ); Assert.IsTrue(collection.Load(oq)); Assert.AreEqual(2, collection.Count); }
public void InnerJoinFourTables() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); EmployeeQuery emp = new EmployeeQuery("e"); EmployeeTerritoryQuery empTerr = new EmployeeTerritoryQuery("et"); TerritoryQuery terr = new TerritoryQuery("t"); TerritoryExQuery terrEx = new TerritoryExQuery("tx"); emp.Select(emp.FirstName, emp.LastName, terr.Description.As("Territory"), terrEx.Notes); emp.InnerJoin(empTerr).On(emp.EmployeeID == empTerr.EmpID); emp.InnerJoin(terr).On(terr.TerritoryID == empTerr.TerrID); emp.InnerJoin(terrEx).On(terrEx.TerritoryID == terr.TerritoryID); emp.Where(terrEx.Notes.IsNotNull()); Assert.IsTrue(collection.Load(emp)); Assert.AreEqual(2, collection.Count); string theName = collection[1].GetColumn("Territory") as string; Assert.AreEqual("North", theName); }
public void CrossDbJoin() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SqlClientProvider": // AggregateDb AggregateTestQuery aq = new AggregateTestQuery("a"); // ForeignKeyTest EmployeeQuery eq = new EmployeeQuery("e"); eq.Select(eq.LastName, eq.FirstName, aq.Age); eq.LeftJoin(aq).On( eq.LastName == aq.LastName & eq.FirstName == aq.FirstName); eq.OrderBy(eq.LastName.Ascending, eq.FirstName.Ascending); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(22, collection[2].GetColumn("Age")); break; default: Assert.Ignore("SQL Server only"); break; } }
public void LeftWithExplicitParen() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); EmployeeQuery eq = new EmployeeQuery("eq"); CustomerQuery cq = new CustomerQuery("cq"); eq.Select(eq.EmployeeID, eq.LastName, cq.CustomerName); eq.LeftJoin(cq).On(eq.EmployeeID == cq.StaffAssigned); eq.Where(eq.Age == 20); eq.Where(new esComparison(esParenthesis.Open)); eq.es.DefaultConjunction = esConjunction.Or; for (int i = 0; i < 4; i++) { eq.Where( eq.Supervisor == i & eq.EmployeeID == i + 1); } eq.Where(new esComparison(esParenthesis.Close)); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(5, collection.Count); }
public void JoinFourTablesInnerLeft() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.MSAccessProvider": Assert.Ignore("Not supported."); break; default: EmployeeQuery emp = new EmployeeQuery("e"); EmployeeTerritoryQuery empTerr = new EmployeeTerritoryQuery("et"); TerritoryQuery terr = new TerritoryQuery("t"); TerritoryExQuery terrEx = new TerritoryExQuery("tx"); emp.Select(emp.FirstName, emp.LastName, terr.Description.As("Territory"), terrEx.Notes); emp.LeftJoin(empTerr).On(emp.EmployeeID == empTerr.EmpID); emp.InnerJoin(terr).On(empTerr.TerrID == terr.TerritoryID); emp.LeftJoin(terrEx).On(terr.TerritoryID == terrEx.TerritoryID); Assert.IsTrue(collection.Load(emp)); Assert.AreEqual(8, collection.Count); break; } }
public void MixedANDAndORInOn() { ProductCollection collection = new ProductCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); int empId = 1; ProductQuery prd = new ProductQuery("pq"); OrderItemQuery item = new OrderItemQuery("oiq"); OrderQuery ord = new OrderQuery("oq"); CustomerQuery cust = new CustomerQuery("cq"); EmployeeQuery emp = new EmployeeQuery("eq"); prd.Select(prd.ProductID); prd.InnerJoin(item).On(prd.ProductID == item.ProductID); prd.InnerJoin(ord).On(item.OrderID == ord.OrderID); prd.InnerJoin(cust).On(ord.CustID == cust.CustomerID & (ord.CustSub == cust.CustomerSub | ord.EmployeeID == cust.StaffAssigned)); prd.InnerJoin(emp).On(cust.Manager == emp.EmployeeID); prd.Where(emp.EmployeeID == empId); prd.Where(prd.Discontinued == false); prd.OrderBy(prd.ProductID.Ascending); Assert.IsTrue(collection.Load(prd)); Assert.AreEqual(9, collection.Count); }
public void RightWithWhereIn() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SQLiteProvider": Assert.Ignore("RIGHT JOIN not supported."); break; default: List <string> custList = new List <string>(); custList.Add("01001"); custList.Add("40000"); custList.Add("XXXXX"); EmployeeQuery eq = new EmployeeQuery("eq"); CustomerQuery cq = new CustomerQuery("cq"); eq.Select(eq.EmployeeID, eq.LastName, cq.CustomerID, cq.CustomerName); eq.RightJoin(cq).On(eq.EmployeeID == cq.Manager); eq.Where(cq.CustomerID.In(custList)); EmployeeCollection coll = new EmployeeCollection(); coll.es.Connection.Name = "ForeignKeyTest"; Assert.IsTrue(coll.Load(eq)); Assert.AreEqual(14, coll.Count); break; } }
public void RightSimple() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SQLiteProvider": Assert.Ignore("RIGHT JOIN not supported."); break; default: EmployeeQuery eq = new EmployeeQuery("eq"); CustomerQuery cq = new CustomerQuery("cq"); eq.Select(eq.EmployeeID, eq.LastName, cq.CustomerName); eq.RightJoin(cq).On(eq.EmployeeID == cq.StaffAssigned); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(56, collection.Count); break; } }
public void LeftWithContains() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); switch (collection.es.Connection.ProviderSignature.DataProviderName) { case "EntitySpaces.SqlClientProvider": string nameTerm = "acme NEAR company"; EmployeeQuery eq = new EmployeeQuery("eq"); CustomerQuery cq = new CustomerQuery("cq"); eq.Select(eq.EmployeeID, eq.LastName, cq.CustomerName); eq.LeftJoin(cq).On(eq.EmployeeID == cq.StaffAssigned); eq.Where(cq.CustomerName.Contains(nameTerm)); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(2, collection.Count); break; default: Assert.Ignore("Not supported"); break; } }
public void TestSerializeQuery() { EmployeeQuery query = new EmployeeQuery("e"); query.Where(query.EmployeeID.In(1, 2, 3, new List <object>() { 1, 2, 3 })); string qq = EmployeeQuery.SerializeHelper.ToXml(query); List <Type> types = new List <Type>(); types.Add(typeof(EmployeeQuery)); EmployeeQuery employeeQuery = EmployeeQuery.SerializeHelper.FromXml( qq, typeof(EmployeeQuery), types) as EmployeeQuery; EmployeeCollection c = new EmployeeCollection(); c.es.Connection.Name = "ForeignKeyTest"; c.Load(employeeQuery); Assert.IsTrue(c.Count == 3); }
public async Task RemoveFromRole(int userId, string role) { var employee = (await _employeeService.GetEmployeeDtoAsync(EmployeeQuery.WithUserId(userId))).Value; switch (role) { case Client: throw new NotSupportedException(); case Employee: if (employee != null) { await _employeeService.DeleteModelAsync(employee.Id); } break; default: if (employee != null && RolesToRights.ContainsKey(role) && employee.Rights.HasFlag(RolesToRights[role])) { employee.Rights = employee.Rights ^ RolesToRights[role]; await _employeeService.UpdateModelAsync(employee); } break; } }
public async Task <IEnumerable <Employee> > GetByPersonIdAsync(Guid id) { using (var connection = context.CreateConnection()) { return(await connection.QueryAsync <Employee>(EmployeeQuery.ByPersonId(id))); } }
public void WhereWithJoin() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); // SubQuery of Territories TerritoryQuery tq = new TerritoryQuery("t"); tq.Select(tq.TerritoryID); tq.Where(tq.Description == "North" | tq.Description == "West"); // EmployeeTerritory Query for Join EmployeeTerritoryQuery etq = new EmployeeTerritoryQuery("et"); // Employees matching those territories EmployeeQuery eq = new EmployeeQuery("e"); eq.es.Distinct = true; eq.Select(eq.EmployeeID, etq.TerrID); eq.LeftJoin(etq).On( eq.EmployeeID == etq.EmpID); eq.Where(etq.TerrID.In(tq)); eq.OrderBy(eq.EmployeeID.Ascending); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(3, collection.Count); }
public void WhereExists() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); // SubQuery of Employees with a null Supervisor column. EmployeeQuery sq = new EmployeeQuery("s"); sq.es.Distinct = true; sq.Select(sq.EmployeeID); sq.Where(sq.Supervisor.IsNull()); // If even one employee has a null supervisor, // i.e., the above query has a result set, // then run a list of all employees. EmployeeQuery eq = new EmployeeQuery("e"); eq.Select(eq.EmployeeID, eq.Supervisor); eq.Where(eq.Exists(sq)); Assert.IsTrue(collection.Load(eq)); Assert.AreEqual(5, collection.Count); }
public void WhereInANDedTogetherOperator() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); EmployeeQuery eq1 = new EmployeeQuery("e1"); EmployeeQuery eq2 = new EmployeeQuery("e2"); EmployeeQuery eq3 = new EmployeeQuery("e3"); eq2.Select(eq2.EmployeeID); eq3.Select(eq3.EmployeeID); eq1.Where(eq1.EmployeeID.In(eq2) & eq1.EmployeeID.In(eq3)); Assert.IsTrue(collection.Load(eq1)); Assert.AreEqual(5, collection.Count); string lq = collection.Query.es.LastQuery; string[] one = lq.Split('1'); Assert.AreEqual(4, one.GetLength(0)); string[] two = lq.Split('2'); Assert.AreEqual(3, two.GetLength(0)); string[] three = lq.Split('3'); Assert.AreEqual(3, three.GetLength(0)); }
public GetEmployeeListQuery(EmployeeQuery employeeQuery) { if (employeeQuery is null) { throw new ArgumentNullException(nameof(employeeQuery)); } Address = employeeQuery.Address; City = employeeQuery.City; Country = employeeQuery.Country; Email = employeeQuery.Email; Fax = employeeQuery.Fax; FirstName = employeeQuery.FirstName; FromBirthDate = employeeQuery.FromBirthDate == null ? null : new BirthDateFilter(employeeQuery.FromBirthDate); FromHireDate = employeeQuery.FromHireDate == null ? null : new HireDateFilter(employeeQuery.FromHireDate); LastName = employeeQuery.LastName; Order = employeeQuery.Order; PageNumber = employeeQuery.PageNumber; PageSize = employeeQuery.PageSize; Phone = employeeQuery.Phone; PostalCode = employeeQuery.PostalCode; State = employeeQuery.State; Title = employeeQuery.Title; ToBirthDate = employeeQuery.ToBirthDate == null ? null : new BirthDateFilter(employeeQuery.ToBirthDate); ToHireDate = employeeQuery.ToHireDate == null ? null : new HireDateFilter(employeeQuery.ToHireDate); }
public override int Count(EmployeeQuery query) { using (var q = ConvertQuery(query)) using (var result = q.Run()) { return(result.Count); } }
public void SingleUnionWithJoin() { CustomerCollection coll = new CustomerCollection(); coll.es.Connection.Name = "ForeignKeyTest"; CustomerQuery cq1 = new CustomerQuery("c1"); EmployeeQuery eq1 = new EmployeeQuery("e1"); cq1.Select(cq1.CustomerID, cq1.CustomerSub, cq1.CustomerName, eq1.LastName); cq1.InnerJoin(eq1).On(cq1.Manager == eq1.EmployeeID); cq1.Where(cq1.DateAdded.Between(Convert.ToDateTime("2005-01-01"), Convert.ToDateTime("2005-12-31"))); CustomerQuery cq2 = new CustomerQuery("c2"); EmployeeQuery eq2 = new EmployeeQuery("e2"); cq2.Select(cq2.CustomerID, cq2.CustomerSub, cq2.CustomerName, eq2.LastName); cq2.InnerJoin(eq2).On(cq2.Manager == eq2.EmployeeID); cq2.Where(cq2.DateAdded.Between(Convert.ToDateTime("2006-01-01"), Convert.ToDateTime("2006-12-31"))); cq1.Union(cq2); cq1.OrderBy(cq1.CustomerID.Ascending, cq1.CustomerSub.Ascending); //string lq = cq1.Parse(); Assert.IsTrue(coll.Load(cq1)); Assert.AreEqual(49, coll.Count); Assert.AreEqual("Smith", coll[0].GetColumn("LastName")); }
public override int Count(EmployeeQuery query) { using (var enumerator = this.ConvertQuery(query).Run()) { return(enumerator.Count); } }
public async Task <IEnumerable <Employee> > GetAllAsync() { using (var connection = context.CreateConnection()) { return(await connection.QueryAsync <Employee>(EmployeeQuery.All())); } }
public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc) { var searchDocs = new List <SearchDocument> (); var settings = new EmployeeListSettingsRepository().GetSettings(moduleInfo); var portalSettings = HttpOffContextHelper.GetPortalSettings(moduleInfo.PortalID, moduleInfo.TabID, moduleInfo.CultureCode); IEnumerable <EmployeeInfo> employees = null; using (var modelContext = new UniversityModelContext()) { employees = new EmployeeQuery(modelContext).ListByDivisionId( settings.DivisionID, settings.IncludeSubdivisions, (EmployeeListSortType)settings.SortType); } var now = DateTime.Now; foreach (var employee in employees) { if (employee.LastModifiedOnDate.ToUniversalTime() > beginDateUtc.ToUniversalTime()) { var sd = new SearchDocument { PortalId = moduleInfo.PortalID, AuthorUserId = employee.LastModifiedByUserId, Title = employee.FullName(), Body = employee.SearchText(), ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime(), UniqueKey = string.Format("University_Employee_{0}", employee.EmployeeID), Url = employee.GetSearchUrl(moduleInfo, portalSettings), IsActive = employee.IsPublished(now) }; searchDocs.Add(sd); } } return(searchDocs); }
public async Task DeleteAsync(Guid id) { using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(EmployeeQuery.Delete(id)); } }
public void TwoAddStringsThenConcatenated() { EmployeeCollection collection = new EmployeeCollection(); collection.es.Connection.ConnectionString = UnitTestBase.GetFktString(collection.es.Connection); EmployeeQuery eq = new EmployeeQuery("eq"); eq.Select ( eq.EmployeeID, ( (eq.LastName.ToLower() + eq.FirstName.ToLower()).Trim() + " : " + (eq.LastName.ToUpper() + eq.FirstName.ToUpper()).Trim() ).Trim().As("SomeColumn") ); Assert.IsTrue(collection.Load(eq)); string theName = collection[0].GetColumn("SomeColumn") as string; Assert.AreEqual("smithjohn : SMITHJOHN", theName); }
public void LoadJoined() { CustomerQuery cq = new CustomerQuery("c"); EmployeeQuery eq = new EmployeeQuery("e"); EmployeeQuery eq2 = new EmployeeQuery("e2"); OrderQuery oq = new OrderQuery("o"); OrderItemQuery oiq = new OrderItemQuery("oi"); ProductQuery pq = new ProductQuery("p"); cq.Select( cq.CustomerID, cq.CustomerSub, cq.CustomerName, eq, eq2.LastName.As("ReportsTo"), oq.PlacedBy, oq.OrderDate, oiq, pq.ProductName, pq.Discontinued); cq.LeftJoin(eq).On(eq.EmployeeID == cq.Manager); cq.LeftJoin(eq2).On(eq.Supervisor == eq2.EmployeeID); cq.LeftJoin(oq).On(cq.CustomerID == oq.CustID && cq.CustomerSub == oq.CustSub); cq.LeftJoin(oiq).On(oq.OrderID == oiq.OrderID); cq.LeftJoin(pq).On(oiq.ProductID == pq.ProductID); CustomerCollection coll = new CustomerCollection(); coll.es.Connection.Name = "ForeignKeyTest"; Assert.IsTrue(coll.Load(cq)); Assert.AreEqual(69, coll.Count); }
private EmployeeViewModel GetEmployee() { var userId = int.Parse(User.Identity.GetUserId()); var res = _employeeService.GetEmployee(EmployeeQuery.WithUserId(userId)); return(res.Value); }
private void Inicializer() { employeeService = EmployeeService.GetInstance(); employeeQuery = EmployeeQuery.GetInstance(); employeeLogic = EmployeeLogic.GetInstance(employeeService, employeeQuery); responseClient = ResponseClient.GetInstance(); errorMessage = null; }
public override long Enumerate(EmployeeQuery query) { long ages = 0; foreach (var employee in this.ConvertQuery(query)) { ages += employee.Age; } return ages; }
public override long Enumerate(EmployeeQuery query) { long ages = 0; foreach (var employee in this.ConvertQuery(query)) { var name = employee.Name; var isHired = employee.IsHired; ages += employee.Age; } return ages; }
public override long Enumerate(EmployeeQuery query) { using (var enumerator = this.ConvertQuery(query).Run()) { long ages = 0; foreach (var row in enumerator) { ages += row.Document.GetProperty<long>("age"); } return ages; } }
private Query ConvertQuery(EmployeeQuery query) { var q = this.db.CreateAllDocumentsQuery(); q.PostFilter = row => { var name = row.Document.GetProperty<string>("name"); var age = row.Document.GetProperty<long>("age"); var isHired = row.Document.GetProperty<bool>("is_hired"); return name.Contains(query.Name) && age >= query.MinAge && age <= query.MaxAge && isHired == query.IsHired; }; return q; }
public override int Count(EmployeeQuery query) { return this.ConvertQuery(query).Count(); }
private TableQuery<Employee> ConvertQuery(EmployeeQuery query) { return from employee in this.connection.Table<Employee>() where employee.Name.Contains(query.Name) && employee.Age >= query.MinAge && employee.Age <= query.MaxAge && employee.IsHired == query.IsHired select employee; }
public ActionResult Index(EmployeeQuery query, PaginationParams pagination) { var result = Context.Fulfill(query).Paginate(pagination); return this.View(result); }
private IQueryable<Employee> ConvertQuery(EmployeeQuery query) { var name = query.Name; var minAge = query.MinAge; var maxAge = query.MaxAge; var isHired = query.IsHired; return from employee in this.realm.All<Employee>() where employee.Name.Contains("0") // String methods in Realm queries still support only literals && employee.Age >= minAge && employee.Age <= maxAge && employee.IsHired == isHired select employee; }