开发者

Create, edit, delete exposed via Web Service API - best design pattern?

开发者 https://www.devze.com 2023-01-23 01:38 出处:网络
I have a web service which exposes functionality to create, edit, delete user settings. Right now I have a UserSetting entity which is instantiated on each call to the web service. This entity has met

I have a web service which exposes functionality to create, edit, delete user settings. Right now I have a UserSetting entity which is instantiated on each call to the web service. This entity has methods Create, Edit and Delete and other required properties.

The intentions are to serialise this class as an XML file and post that to a folder where it will be picked up by a scheduled console application, deserialised and the final stage of the work completed. The fact that an XML file is being used is not i开发者_Python百科mportant - I understand there are other messaging techniques that can be used.

My knowledge of design patterns is limited but I want to adopt best practice. I have a few ideas in my head that there should be an IUserSettingTask and classes which implement this interface UserSettingCreator, UserSettingDeleter which have separate methods that are executed at web-service-time and at console-time.

The solution needs to be extensible because there will be a need to create settings for departments and device which I envisage will implement the same interface.

Any help with this will be great. Thanks.


My advice will be to separate the Create/Delete/Edit operatios from the UserSettings entity. Keep UserSettings as pure DataContract of the service.

Let the service to operation on the entity not the entity to do such operations on itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消