Night Walker
Night Walker

Reputation: 21280

DTO with WCF and extension methods

I am using DTOs in my code to transfer data between layers. I have several extension methods to map them to my BL.

Now I want to use those DTOs as a result of my WCF APIs.

Is that a good approach I am not sure will those extension methods would be also exposed with the DTO classes or not , if yes how I can avoid it?

Upvotes: 0

Views: 443

Answers (2)

gangelo
gangelo

Reputation: 3182

They may be exposed on the client side, if you put your extensions in the same namespace as your DTOs; this could happen, say, when creating your ViewModels from your DTOs for example.

Upvotes: 0

empi
empi

Reputation: 15901

Your extension methods will not be exposed as a part of your wcf service contract. If your DTOs contain "normal" methods they also will not be exposed. Only DataContract of those DTOs will be shown in your service contract.

Upvotes: 2

Related Questions