开发者

Web service that has Edmx objects as parameters

开发者 https://www.devze.com 2023-03-01 09:35 出处:网络
I feel like exposing an edmx class as a parameter to a web service is not a good idea. I feel like it\'s wrong design. eg.

I feel like exposing an edmx class as a parameter to a web service is not a good idea. I feel like it's wrong design. eg.

[WebMethod]
MyWebservice(int customerID, UserProfile profile){
}

now UserProfile is a class generated by Edmx framework. You might argue if the profile object is an input then it will not get a proper id (edmx id) because it will be created out of the context (since the web service can be called from any external consumer).

But i'm开发者_运维百科 also looking for more explanation why exposing edmx class as a web service is not a good design. If you think it's ok, please tell me.

thanks


It's generally considered good design practice to keep the data contracts of a web service and the data model objects associated with a database separate, so that if required you could change the entity model used at the back of a web service, without having to change the interface that you expose to consumers of the service.

0

精彩评论

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