开发者

Repository pattern with a WCF Rest Service and returning IQUERYABLE using LINQ to OBJECTS?

开发者 https://www.devze.com 2023-01-18 01:50 出处:网络
i wish to create a repository pattern but with a WCF Rest Service which controls the data access.Can anyone confirm or help with my thinking / config.

i wish to create a repository pattern but with a WCF Rest Service which controls the data access. Can anyone confirm or help with my thinking / config.

  1. ASP.NET Controllers >> call to service (not rest service but service of a repository pattern)
  2. Repository Pattern Service >> calls to repository
  3. Repository >> calls to WCF Rest Service to receive data.

Is this setup good, or should i remove the Repository layer and have the Repository service call directly to the REST Service?

Does anyone do a similar setup?

I would love to hear comments?

Basically my Rest Service (WCF) would return XHTML...

So in my repository layer how would i convert whats returned from my Rest Service into IQUERYABLE? I presume i would need to do ReadAsDataContract into a class (data contract) and then use LINQ to OBJECTS?? This is a causing me a bit of confusing

Becuase of course the normal is to return IQUERYABLE form the repository layer to the service layer

Then the service layer returns to the calling client normal as TOLIST or similar.

Really appreciated any input anyone has.

Thanks

EDIT

Ermm after rethining this, i think i am doing it wrong... i should basically just covert the Service layer of the repository into a WCF REST Service... this way my other clients can call my rest service??

I suppose i keep the Repository layer there but i could get this to call开发者_开发知识库 a Data Services layers (technically another rest service) for my data acces..

Does this make better sense?


By trying to hide the REST layer behind a repository you are attempting to implement distributed objects. REST was never intended as an approach to implement this type of architecture.

If you really want to do REST, you are going about it the wrong way. However, you are far from alone in this pursuit.


Update:

The only place I see a repository for domain objects is on the server, behind the REST interface. All you have on the client is media type handlers and user agent scripts.

0

精彩评论

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