質問

I want to build a WCF Service application, which is supposed to use a library of mine in order to make all the library's methods available for the service's client. There must be a better way than explicitly writing an OperationContract for each method of my library, which acts as some kind of proxy and calls the library's actual method on the server's side in order to get the returnvalue and deliver it back to the client.

役に立ちましたか?

解決

If you want access to those methods, you'll need to create operation contracts for them.

You can make this easier by creating a small app that loops through the code files, finds and the method signatures, and then formats them for the interface. Then you'd just need to copy that code into the interface.

他のヒント

There must be a better way than explicitly writing an OperationContract for each method of my library

No, not really.

Also remember a library often is stateful, i.e. you instantiate an object, and when you call instance methods against that object, you preserve state as you saved private members at instance level.

Only static methods could be 'directly' mapped to service operations.

Most probably, you might want to entirely write your WCF contract from scratch to make it service-friendly (i.e. stateless), and possibly interoperable (faults instead of exceptions...etc.)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top