ObjectDataSource and Linq. Please, help! I don't know what else to try. Thank You.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

I used a "Linq to SQL classes" in VS 2008 to map the tables of a
database: MyDbDataContext

One of the tables is named Tags and has 2 columns: TagID and Text.
This table is related to a second table named Articles through a table
ArticlesTags.

I would like to use an ObjectDataSource as a layer between my data and
a ListView.

In my page I created the following:

private void odsTags_Init(object sender, EventArgs e)
{
odsTags.ID = "odsTags";
odsTags.SelectMethod = "GetTags";
odsTags.TypeName = "MyDbDataContext";
}

public static ICollection GetTags()
{
MyDbDataContext database = new MyDbDataContext();
var query = from t in db.Tags
select new
{
TagId = t.TagId,
TagText = t.TagText,
Active = t.ArticlesTags.Any
};
return tags;
}

I get the following error:
ObjectDataSource 'odsTags' could not find a non-generic method
'GetTags' that has no parameters.

I have no idea what I am doing wrong. I am not able to solve it!
I tried to Google for a solution but I didn't find it. I don't know
what I am doing wrong.

This is the first time I use an ObjectDataSource with a Linq
DataContext.

Thanks,
Miguel
.



Relevant Pages

  • Re: ObjectDataSource and Linq. Please, help! I dont know what else to try. Thank You.
    ... One of the tables is named Tags and has 2 columns: TagID and Text. ... MyDbDataContext database = new MyDbDataContext; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Desktop Application Data Access Layer
    ... I decided to make the DataBroker instancing ... If I was going to do this, then I would use Alinq a LINQ provider against the Access Database. ... It would allow me to use a virtual database, a model based on objects, ORM, and LINQ with OOPs more effectively. ... Microsoft LINQ defines a set of query operators that can be used to query, project and filter data in arrays, enumerable classes, XML, relational database, and third party data sources. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Desktop Application Data Access Layer
    ... | against the Access Database. ... | Why would I use Alinq? ... | model based on objects, ORM, and LINQ with OOPs more effectively. ... | What is Language Integrated Query? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Linq Over Dataset/SQL Server in terms of Performance, Concurre
    ... If you load the database into memory, ... It is estimated that there would be 50K concurrency users. ... Management of LINQ over SQL/DataSet. ... We observed that the data storing in SQL Server ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is the DAL dead?
    ... This plug-in gets data from a database and then displays ... since I know that their using SQL server 2005 (currently upgrading ... I can do it with Linq solutions. ... Also, there are Linq Web service provider applications that have a Web service and database on the backend, and you can use a client application that uses Linq to query the database through the Web service, a Linq service provider. ...
    (microsoft.public.dotnet.general)