Local Sequence cannot be used ... except the Contains() operator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Local Sequence cannot be used ... except the Contains() operator

    Hello,

    I am getting an error:
    NotSupportedExc eption was unhandled by user code.
    Local Sequence cannot be used in Linq to SQL implementation of query
    operators except the Contains() operator.

    On the Linq query:

    List<PostsTagti es = (from t in database.Tags
    join pt in paper.Tags on t.Name equals
    pt.Name
    select new PostsTag {
    PostID = paper.Post.Post ID,
    TagID = t.TagID
    }).ToList();

    Basically Tag has two properties: TagID and Name.

    paper.Tags is a List<Tagwhere each Tag has only the Name defined.
    So I need to pick the TagID from database.Tags by finding which Tag
    given the name.

    I think the problem is that the join in theory can give me more than
    one record.
    However, I know that there aren't two tags with same Name as I test it
    before I insert a new tag.

    How can I solve this without having to introduce a Sub Query?

    Thanks,
    Miguel
Working...