Cannot Resolve Symbol Select in ActiveRecord Fluent Query
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;
开发者_JAVA技巧 }
ReSharper 4.5: Cannot resolve symbol Select.
Oh, I should mention that the classes are working fine using Linq.
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
.
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.
精彩评论