Coalesce icon indicating copy to clipboard operation
Coalesce copied to clipboard

[Docs] Describe the nuances between class [Service]s vs interface [Service]s

Open ascott18 opened this issue 7 years ago • 1 comments

http://coalesce.readthedocs.io/en/latest/pages/modeling/model-types/services/

For a C# interface annotated with [Coalesce,Service], all methods on that interface will be exposed automatically. The idea is that you should always make an interface that describes exactly the service being exposed through Coalesce. If there are members on the interface that you don't want exposed, they shouldn't be on the interface. They should be on some other derived interface if they must be in an interface.

For a C# class annotated with [Coalesce,Service], only methods exposed with [Coalesce] will be exposed. This is consistent with the method exposing behavior of model types. Since you are choosing to expose an implementation explicitly, that implementation may end up with other methods on it that you don't want exposed, and that's OK - that's the whole reason we moved to exposing methods on classes with [Coalesce] explicitly.

ascott18 avatar May 02 '18 20:05 ascott18

Great change. I just wrote one of these a few nights ago.

GrantErickson avatar May 03 '18 03:05 GrantErickson