Question

I created a Class Library named Repository and which includes LINQ To SQL file which stores a ORM of SQL Server Database, besides that I also created another Class Library named Services which has the reference of the Repository class library and I want to use the LINQ to SQL file locating in Repository in Services but I can't see the Extension Methods but I can create an instance of the LinqToSQL in Services.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Repository; // This is the referred class library



namespace Core {
    class BugListService {

        BBDatabaseDataContext dbContext = new BBDatabaseDataContext();

        public int CreateBug(BugList bug) {

            dbContext.BugLists. // <= The extension methods don't appear in intellisense
        }

    }
}
Was it helpful?

Solution

Did you add a reference to System.Core? The extension methods for linq live there.

OTHER TIPS

Can you call the extension method like a normal static method? See if you can call:

<Declaring Type for the Extension Method>.<Extension Method Name>(bug, <other params>)

Might give you some more information about what is going wrong...

Also, you might want to check that you have a Using clause for the exact namespace of the type that declares the extension method, I've had similar issues in the past...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top