Generally speaking , many methods in one svc is not a good practice.
This will make your service has too much code that is not necessary.
If you want to modify your service , others that rely on your service may need to change too.
For example, if you have a service with 100 method, all the clients refer to this service will need to generate a service proxy with 100 method.
When one of the method changes , all the clients should also change.
If you extract related method with related logic into a new svc , if you want to change this svc, because it is smaller , it will have smaller effect.
Many smaller services are easy to work with each other and provide service and svc with too many methods is hard to work with each other and relates to too many clients.
For performance and memory , it depends on the code you write and how many clients call your service and others.
Best regards,
Ackerly Xu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
I have seen it done both ways. It doesn't matter as long as the methods are using objects in a classlib project the WCF service project has reference to that is doing the actual work/functionality with the WCF service just being passthrough logic.
This allows the classlib project that has classes/objects that implement an Interface to be unit or integration tested without the WCF service being involved.
If you find the post has answered your issue, then please mark post as 'answered'.
Member
175 Points
608 Posts
One svc with many methods or many svc with few methods
May 06, 2019 03:37 AM|neoaguil17|LINK
Hi
I don't know what is the best option about: performance, scaling and use of memory..
Contributor
3460 Points
1300 Posts
Re: One svc with many methods or many svc with few methods
May 06, 2019 05:55 AM|Ackerly Xu|LINK
Hi neoaguil17,
Generally speaking , many methods in one svc is not a good practice.
This will make your service has too much code that is not necessary.
If you want to modify your service , others that rely on your service may need to change too.
For example, if you have a service with 100 method, all the clients refer to this service will need to generate a service proxy with 100 method.
When one of the method changes , all the clients should also change.
If you extract related method with related logic into a new svc , if you want to change this svc, because it is smaller , it will have smaller effect.
Many smaller services are easy to work with each other and provide service and svc with too many methods is hard to work with each other and relates to too many clients.
For performance and memory , it depends on the code you write and how many clients call your service and others.
Best regards,
Ackerly Xu
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Contributor
3971 Points
3339 Posts
Re: One svc with many methods or many svc with few methods
May 06, 2019 06:45 AM|DA924|LINK
I have seen it done both ways. It doesn't matter as long as the methods are using objects in a classlib project the WCF service project has reference to that is doing the actual work/functionality with the WCF service just being passthrough logic.
This allows the classlib project that has classes/objects that implement an Interface to be unit or integration tested without the WCF service being involved.