public UserTransformer() { this.TransformResults = users => from user in users let userId = user.Id.ToString().Replace("users/", string.Empty) let client = user.ClientId.HasValue ? this.LoadDocument<DataObjects.Client>("clients/" + user.ClientId.Value) : null select new { Id = userId, user.EmailAddress, user.FirstName, user.LastName, user.LastLoginDate, user.PhoneNumber, user.IsActive, user.IsVerified, user.Role, user.IsAutoBilled, user.IsInvoiceEmailed, user.LogoUrl, Client = client != null ? new { Id = user.ClientId.GetValueOrDefault(), client.OperatingName, client.LegalName, client.LogoUrl } : null }; }
var users = this.work.Query<User>();
switch (this.Role) { case Constants.Role.Merchant: users = !this.Client.Customers.IsNullOrEmpty() ? users.Where(x => x.ClientId == this.ClientId || x.Id.In(this.Client.Customers)) : users.Where(x => x.ClientId == this.ClientId); break; case Constants.Role.User: users = !this.User.Customers.IsNullOrEmpty() ? users.Where(x => x.Id.In(this.User.Customers)) : users.Where(x => x.Id == this.UserId); break; }
return users.TransformWith<UserTransformer, UserDetail>();
http://localhost:8080/databases/ronin/indexes/dynamic/Users?&query=ClientId:1 OR %40in<__document_id>:(UserDetails%2F33%2CUserDetails%2F34) &pageSize=0&resultsTransformer=UserTransformer
Query: ClientId:1 OR @in<__document_id>:(UserDetails/33,UserDetails/34)
Time: 7 ms
from user in docs.Usersselect new { Id = user.__document_id, ClientId = user.ClientId, CreatorId = user.CreatorId, EmailAddress = user.EmailAddress, IsActive = user.IsActive, IsVerified = user.IsVerified, PasswordResetToken = user.PasswordResetToken, VerificationId = user.VerificationId}
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hibernating Rhinos Ltd
Tal Weiss l Core Team Developer l Mobile:+972-54-802-4849
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
RavenDB paving the way to "Data Made Simple" http://ravendb.net/
Metadata
Raven-Entity-NameUsersEtag01000000-0000-0001-0000-00000000000FLast-Modifiedan hour ago (27/03/2015 20:45 (UTC))Size in KB0.87
users.TransformWith<UserTransformer, UserDetail>();