tags:

views:

139

answers:

2

What could possibly be wrong here?

    public Contact GetContact(int key)
    {
        var contact = new ContactManagerDB.Select
            .From<Contact>()
            .Where(ContactsTable.IdColumn).IsEqualTo(key)
            .ExecuteSingle<Contact>();

        return contact;
    }

ReSharper 4.5: Cannot resolve symbol Select.

Oh, I should mention that the classes are working fine using Linq.

A: 

Just comparing your query syntax to the one on the subsonic website, You're selecting a single object from the database of type Contact, but you're naming your result variable as type var named contact. Try changing var contact to Contact c and then return c; at the end. It might just be that the query is looking for a Select function symbol that returns type var when selecting type Contact.

WarrenB
Side note, my major is databases but I've never worked with this particular program before.
WarrenB
A: 

Well, the documentation example is wrong. Here's the correct query notation:

        var contact = new ContactManagerDB().Select
            .From<Contact>()
            .Where(ContactsTable.IdColumn).IsEqualTo(key)
            .ExecuteSingle<Contact>();

The discrepancy being the missing parentheses after "ContactManagerDB()".

Someone should update the queries in the SubSonic Active Record Web site documentation.

Fred Chateau