Avoiding god classes of web service

I have a complex RIA client that interacts with the WCF SOAP web service, and the second is online. This led to a terrible class of gods containing 131 [OperationContract] methods and even more private methods.

Personally, I have no problem with this; I use the search and navigation features for Visual Studio to make it very easy to find my way around the class. Other developers are suffering because of this. They are the ones that slowly scroll around looking for things (it's annoying to watch). I have listed the class in sections, but I'm the only one who seems to take advantage of this (they are, apparently, the more common hate camp in the region).

So, in order to be enjoyable for other programmers and possibly get some resulting benefits that I don’t know about, I want to reorganize the monster. The following options are available here:

Option 1: Web service snippet for individual services

What I don't like about this is breaking my client code. I would have to rewrite it to use the new proxy classes. In addition, I will also have more WCF configuration to support (yuck!). In addition, there may be storage battles in which general private methods must reside.

Option 2: Use Partial Classes

This idea seems attractive to me. What I will do with this approach is that each source file (not too many) is a functional separation of the web service. For example:

MyService.svc.cs
MyService.AccountManagement.svc.cs
MyService.Preferences.svc.cs
MyService.MediaManagement.svc.cs

, , , , - " ". , , .

3: ,

, - , , . , - ?

Update

. .

, , . , , , . , .

+5
6

, , , . .

, , , . ( , ), .

. . ( : , . , .)

. , - , .


-. , - BLL , / , -. , BLL . , API.

+5

, , , , .

, WebService : ... , , .

, , ?

UPDATE:

, / , SOLID . :

, .

SO . - , , ,

+8

, 1 . , , VS , , .

+4

:

131 . . , ?

" ". ( ). - , web.config .svc, .

.svc - ( "-" ):

<%@ ServiceHost Service="Fully.Qualified.Name.Of.Implementation.Class" %>

, svcutil.exe . ChannelFactory<IContract> .

, , , WCF.

+4

, , , . 131 , , , , . RIA, , - , SOAP , .

, , . , .

, , , - . , , . , . . , , 131 .

, , . , , .

, , , . , , ?

, : .

+2

/:

1: , -. 1000 , , . , , , chatty API, , .

2 + : , . , . , http://blog.wekeroad.com/category/mvc-storefront ( 1) - . U - http://www.lostechies.com/content/pablo_ebook.aspx. , , .

As others have said, your service code should be just a tiny layer that translates into the appropriate service format and logic of your application. Consider instructional unit tests, they will seem ridiculous when you work with such code, as this greatly prevents you from using it well. This will constantly remind u / point u where your code is all connected.

0
source

All Articles