开发者

Identifying object instances over service boundaries (WCF)

开发者 https://www.devze.com 2023-03-03 18:33 出处:网络
New to WCF and the whole Service Oriented Architecture thing, and trying to get my head around how it actually works.

New to WCF and the whole Service Oriented Architecture thing, and trying to get my head around how it actually works.

I think I get that it's "just data", ie the proxy objects that WCF creates for me are just handy containers, and not "real" objects with behaviour. The thing I'm unclear on is how "real" objects are identified across the service boundary.

ie. Say I have a service that allows me to edit customers and exposes two methods: GetAllCustomers() SaveCustomer()

If I call GetAllCustomers(), then I end up with a collection of proxy Customer objects. Fine.

Now if I want to edit one of these objects, how do I identify which one I've edited to the SaveCustomer() service method? Do I have t开发者_如何转开发o roll my own "id" field for each customer object, or does WCF somehow track instances for me?

Cheers


WCF definitely doesn't track object instances. Your entities need to implement a way of identifying themselves. Typically it is an Id property but there are different identity mechanisms. A good place to start understanding domain design for your entities is this link.

0

精彩评论

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