Search code examples
c#.netwcfdatacontract

Is it a BAD design to have [DataContract] marked class in the business layer?


I need to use a class that represents a Client Request that is sent to my REST WCF Service.

But I want to pass this request also to my method in the business layer. (Currently it is part of the WCF service)

Is it a BAD design to have [DataContract] marked class in the business layer?


Solution

  • So as I stated in comment:

    If you feel bad about it introduce an interface that is implemented by that class and use that in your business layer. Note that DataContract attribute is merely marker for serialization engine.