Bind To Web Service Tutorial

1 reply. Last post: May 18, 2012 5:46 AM by Hans Kristian
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Frank PMember

I am working the tutorial located here.

When I run the project, I receive the error "Instances of abstract classes cannot be created" at the return context.Customers.ToList(); line when I browse the webservice and when I run the project.

    [WebMethod]
    public List<Customer> GetCustomers()
    {
        northwindDataContext context = new northwindDataContext();
        context.DeferredLoadingEnabled = false;
        context.ObjectTrackingEnabled = false;
        return context.Customers.ToList();
    }

Also, in step 8, the directions state to "and set SerializationMode into Unidirectional." Where do I set this value?

The complete error message is:

System.InvalidOperationException: Instances of abstract classes cannot be created.
   at System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method)
   at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType)
   at System.Data.Linq.SqlClient.ObjectReaderCompiler.Compile(SqlExpression expression, Type elementType)
   at System.Data.Linq.SqlClient.SqlProvider.GetReaderFactory(SqlNode node, Type elemType)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.Table`1.GetEnumerator()
   at System.Data.Linq.Table`1.System.Collections.Generic.IEnumerable<TEntity>.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GridClientBinding.GetCustomers() in c:\Venture21\MyServiceExample\App_Code\GridClientBinding.cs:line 37
All times are GMT -5. The time now is 12:48 AM.
Previous Next