“Lambda Parameter not in scope” exception using SimpleRepository’s Single method

subsonicsubsonic3

I'm attempting to use the SimpleRepository to perform a fetch based on a non-ID property. Here's the Customer class I'm using:

    [Serializable]
    public class Customer : IEntity<Guid>
    {
        public Guid ProviderUserKey { get; set; }

        public Guid ID
        {
            get; set;
        }
    }

I'm using SimpleRepository with migrations turned on. The code that throws the "Lambda Parameter not in scope" is below:

    public class CustomerRepository : 
        ICustomerRepository
    {
        private readonly IRepository _impl;

        public CustomerRepository(string connectionStringName)
        {
            _impl = new SimpleRepository(connectionStringName,
                                         SimpleRepositoryOptions.RunMigrations);
        }

        public Customer GetCustomer(string userName)
        {
            var user = Membership.GetUser(userName);

            // Code to guard against a missing user would go here

            // This line throws the exception
            var customer = _impl.Single<Customer>(c => c.ProviderUserKey.Equals(user.ProviderUserKey));

            // Code to create a new customer based on the
            // ASP.NET Membership user would go here

            return customer;
        }
    }

I'm not sure at what point in the LINQ expression compilation this throws, but I am running this example on an empty database. The schema generations gets far enough to create the table structure, but can't evaluate the expression.

Does anyone know what I might be doing wrong?

Thanks!

Best Answer

I've had reports of this - can you add this (and your code) as an issue please?