public void GetUsers_Test()
		{
            using (var appHost = new BasicAppHost(typeof(GetUsersService).Assembly).Init())
		    {
                var request = new GetUsers
                {
                    UserIds = new ArrayOfLong(1, 2),
                    UserNames = new ArrayOfString("User3", "User4")
                };

                var factory = new OrmLiteConnectionFactory(
                    InMemoryDb, SqliteDialect.Provider);

                using (var db = factory.Open())
                {
                    db.DropAndCreateTable<User>();
                    db.Insert(new User { Id = 1, UserName = "******" });
                    db.Insert(new User { Id = 2, UserName = "******" });
                    db.Insert(new User { Id = 3, UserName = "******" });
                    db.Insert(new User { Id = 4, UserName = "******" });

                    var handler = appHost.Resolve<GetUsersService>();

                    var response = handler.Any(request);

                    Assert.That(response.Users.Count, Is.EqualTo(4));
                }
            }
		}
        public GetUsersResponse Any(GetUsers request)
        {
            var users = new List<User>();

            if (request.UserIds != null && request.UserIds.Count > 0)
            {
                users.AddRange(Db.SelectByIds<User>(request.UserIds));
            }

            if (request.UserNames != null && request.UserNames.Count > 0)
            {
                users.AddRange(Db.Select<User>(q => request.UserNames.Contains(q.UserName)));
            }

            return new GetUsersResponse { Users = new ArrayOfUser(users) };
        }
        public GetUsersResponse Any(GetUsers request)
        {
            var users = new List<User>();

            if (request.UserIds != null && request.UserIds.Count > 0)
            {
                users.AddRange(Db.SelectByIds<User>(request.UserIds));
            }

            if (request.UserNames != null && request.UserNames.Count > 0)
            {
                users.AddRange(Db.Select<User>(
                    "UserName IN ({0})", request.UserNames.SqlInValues()));
            }

            return new GetUsersResponse { Users = new ArrayOfUser(users) };
        }