public void CanSelectPartially() { IPartialSelection <UserEntity, UserDto> partialSelection = Query <UserEntity>() .PartialSelect(x => new UserDto(x.Firstname + " " + x.Lastname)); partialSelection .Add(x => new UserDto { Id = x.Id }); partialSelection .Add(x => new UserDto { Username = x.Username }); FlowQuerySelection <UserDto> users = partialSelection .Select(); foreach (UserDto user in users) { Assert.That(user.Id, Is.GreaterThan(0)); Assert.That(Fullnames, Contains.Item(user.Fullname)); Assert.That(Usernames, Contains.Item(user.Username)); } }
public void PartialSelectExample1() { IPartialSelection <UserEntity, UserDto> selectionBuilder = Session.FlowQuery <UserEntity>() .PartialSelect <UserDto>(x => new UserDto(x.Firstname + " " + x.Lastname)); selectionBuilder .Add(x => new UserDto { Username = x.Username }); FlowQuerySelection <UserDto> users = selectionBuilder .Select(); Assert.That(users.Count(), Is.EqualTo(4)); }
public void AggregationsExample6Example3WithInferredGroupBy() { IPartialSelection <UserEntity, AverageLogOnsPerRoleModel> selectionBuilder = Session.FlowQuery <UserEntity>() .PartialSelect(x => new AverageLogOnsPerRoleModel { AverageLogOns = Aggregate.Average(x.NumberOfLogOns) }); selectionBuilder .Add(x => new AverageLogOnsPerRoleModel { Role = x.Role }); FlowQuerySelection <AverageLogOnsPerRoleModel> averageLogOnsPerRole = selectionBuilder .Select(); Assert.That(averageLogOnsPerRole.Count(), Is.EqualTo(3)); }