Barry Dysert
Barry Dysert

Reputation: 705

Entity Framework: 'x' does not contain a definition for 'y' and no extension method 'y' accepting a first argument of type 'x' could be found

I read the other questions that had the same error, but they don't seem to deal with Entity Framework. Unfortunately I'm not experienced with EF, so I'm reaching out to the community for help. Can someone please give me an idea how to eliminate this error?

Thanks.

Sorry for not including the code. I'll post whatever is necessary to help me figure this out:

private int MarkPreviousCallsUncallable(DAL.Dialer.I3_IC_DIALEREntities context, 
    string lob, DataRowCollection i3Identities)
{
    <presumably unrelated stuff>

    var existingDIYContact = context.DIYOUTBOUNDPREVIEW.Where
        (x => x.I3_IDENTITY == i3Identity).FirstOrDefault();

    <presumably unrelated stuff>
}

It's on the var existingDIYContact line where I'm getting the error.

Upvotes: 2

Views: 3232

Answers (1)

Barry Dysert
Barry Dysert

Reputation: 705

Problem solved.

Actually there were two problems. One is that my model was pointing to the wrong database, and the other problem was that even though the table name is DIYOUTBOUNDPREVIEW, for some reason I had to pluralize it in my call:

var existingDIYContact = context.DIYOUTBOUNDPREVIEWs.Where(x => x.I3_IDENTITY == i3Identity).FirstOrDefault();

Thanks all for your help.

Upvotes: 2

Related Questions