views:

108

answers:

2

Hi Everyone,

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
        }

    }
}
A: 

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...

LorenVS
+1  A: 

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

Erik van Brakel
I've found the solution, I should have referred to `System.Data.Linq`
Braveyard
Alright, references are so annoying eh ;-)
Erik van Brakel
Yeap :) I think Visual Studio should be smarter sometimes.
Braveyard