public void And() { // select from Person where FirstName='John' and LastName='Doe' var filter = new Extent(M.Person.ObjectType) { Predicate = new And { Operands = new IPredicate[] { new Equals { PropertyType = M.Person.FirstName, Value = "John", }, new Equals { PropertyType = M.Person.LastName, Value = "Doe" }, }, }, }; var queryExtent = filter.Build(this.Session); var extent = this.Session.Extent(M.Person.ObjectType); var and = extent.Filter.AddAnd(); and.AddEquals(M.Person.FirstName, "John"); and.AddEquals(M.Person.LastName, "Doe"); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public Fetch Get(Guid id) { if (!this.fetchById.TryGetValue(id, out var fetch)) { using (var session = this.databaseService.Database.CreateSession()) { var filter = new Extent(M.PreparedFetch.Class) { Predicate = new Equals(M.PreparedFetch.UniqueId.RoleType) { Value = id }, }; var preparedFetch = (PreparedFetch)filter.Build(session).First; if (preparedFetch != null) { fetch = preparedFetch.Fetch; this.fetchById[id] = fetch; } } } return(fetch); }
public IExtent Get(Guid id) { if (!this.extentById.TryGetValue(id, out var extent)) { using (var session = this.databaseService.Database.CreateSession()) { var filter = new Extent(M.PreparedExtent.Class) { Predicate = new Equals(M.PreparedExtent.UniqueId.RoleType) { Value = id }, }; var preparedExtent = (PreparedExtent)filter.Build(session).First; if (preparedExtent != null) { extent = preparedExtent.Extent; this.extentById[id] = extent; } } } return(extent); }
public void Type() { var query = new Extent(M.Person.ObjectType); var queryExtent = query.Build(this.Session); var extent = this.Session.Extent(M.Person.ObjectType); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }
public void RoleEquals() { var filter = new Extent(M.Person.ObjectType) { Predicate = new Equals { PropertyType = M.Person.FirstName, Value = "John", }, }; var queryExtent = filter.Build(this.Session); var extent = this.Session.Extent(M.Person.ObjectType); extent.Filter.AddEquals(M.Person.FirstName, "John"); Assert.Equal(extent.ToArray(), queryExtent.ToArray()); }