Linq to Entities with WCF

I have all my objects in a separate project in my edmx file, and I provide them to my client application using the WCF service.

This means that I do not need to provide my client application with a direct link to the project containing the edmx file. That would be bad because it associates an object with a query in the database.

But only the objects that my WCF service uses can be accessed from my client application. So, for example, because I have the following code in my service:

public MyClass GetMyClass()
{
     return new MyClass();
}

.. I can use MyClass access in my client application with something like:

myServiceInstance.MyClass cls = new  myServiceInstance.MyClass()

And if I have an object called MyClass2 in my edmx file that I want to use in my client application! How can I install it without providing my client with a direct link to the edmx file project or without using the useless method at my service level, which returns MyClass2

What are other people doing?

thanks a lot

+5
source share
3 answers

, WCF. . ; / / /. , XSD WSDL, / .

, WCF.

:

  • , EDMX . WSDL XSD.
  • , EF v1, . , / - , , WCF .
+3

WCF , ? WCF ( ) - "mex" , MyClass2 . , , ; EF - ... ( , Silverlight, , Compact Framework ..)

ADO.NET Data Services; WCF, LINQ API, WCF, - , , .

+2

"" , , , , - . , - , , , . , -.

Another way to handle this is to simply use svcutil (or "Add a service link ...", although svcutil works best for multiple service endpoints) to generate all the classes that the client will use instead of adding a link to the server project. Thus, the only classes your customer will ever see are those that are exposed by the service.

+1
source

All Articles