0

This is a continuation of my previous question: Could not find an implementation of the query pattern

I'm trying to insert a new 'Inschrijving' into my database. I try this with the following code:

[OperationContract]
public void insertInschrijving(Inschrijvingen inschrijving)
{

    var context = new DataClassesDataContext();

    context.Inschrijvingens.InsertOnSubmit(inschrijving);
    dc.SubmitChanges();
}

But the context.Inschrijvingens.InsertOnSubmit(inschrijving); gives me the following error:

cannot convert from 'OndernemersAward.Web.Service.Inschrijvingen' to 'OndernemersAward.Web.Inschrijvingen'

I call the method in my main page:

 Inschrijvingen1Client client = new Inschrijvingen1Client();

            Inschrijvingen i = new Inschrijvingen();

            client.insertInschrijvingCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(client_insertInschrijvingCompleted);
            client.insertInschrijvingAsync(i);

But as you can see there appears to be something wrong with my Inschrijvingen class, which is auto generated by LINQ. (Auto generated class can be found here: http://pastebin.com/QKuAAKgV)

I'm not entirely sure what is causing this, but I assume it has something to do with the auto generated class not being correct?

Thank you for your time, Thomas

Community
  • 1
  • 1
Schoof
  • 2,715
  • 5
  • 29
  • 41

1 Answers1

1

The problem is that you've got two Inschrijvingen classes - one in the OndernemersAward.Web.Service namespace, and one in the OndernemersAward.Web namespace.

You either need to change the codebase so that you've only got one class, or you need to convert from one type to the other.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Yes indeed this was the problem, I thought I renamed the class but the re-factoring didn't do it's job well enough. Thank you :) – Schoof Nov 22 '11 at 14:18