views:

76

answers:

2

So there is an entity that has an enum property and a wcf service that would return or take that enum type. Should the enum be in the entities assembly and mark it up with attributes or should I duplicate the enums for both assemblies, marking the service enums and leaving the entity enums undecorated? I don't like duplicating the enum types but I don't really want to decorate anything in my entities project either. What's the best practice?

A: 

Decoration isn't needed for enums. Just have one version, and don't decorate it.

McKay
A: 

"Best practice" is whatever makes sense for you. We share all our entity enum types (several hundred of them) on the wire- it just doesn't make sense to duplicate and translate between entity/wire types unless absolutely necessary. As long as everything is 3.5SP1 or better, DataContract/EnumMember decoration is optional. I still do it for consistency (we've been using the stuff since 3.0), but it works fine without.

nitzmahone