ORMs for WebServices DataSources?
There seems to be lots of great Object Relational Mappers out there - several of which I have used myself (LLBLGen being one I like a lot). Does anyone know of any .Net tools out there to help build a rich Data Access layer when the DataSource is not a database - or more specifically, where the datasource is multiple, highly granular, webservices that return lots of Domain Specific objects and DTOs?
Why do I even want a Data Access layer when I have webservices I could just call directly from the BLL you may ask? Well, logging, caching, and pre-fetching mechanisms aside, I would like to be able to translate all the slightly varying webservice DTOs with subtly different naming conventions, and map them to my own, consistently nam开发者_运维百科ed and constructed classes, with a common base type. No small task, so I am hoping there are some tools out there to help!
Thanks for any advice or pointers!
Techinically, what you need is not an ORM, as there is no "relational" part. So, most likely, existing ORM-like tools won't suit out-of-the-box.
I'd suggest you to look at the custom code generation tools, for instance, T4 (builtin in VS2008+) or CodeSmith.
SubSonic 3 has some templates for ActiveRecord and repository classes, you could start with those templates, and change them to use web services as the "backend" instead of the database.
P.S. Just for the reference, here is one thread (started by me some time ago) that discusses ORMs and class auto-generation.
What you're describing isn't an ORM, so you probably won't find what you're after that way.
If the primary goal is to translate between a service reference's object model and your own, look at AutoMapper. It's designed to automate exactly that type of task.
Depending on how complex the scenario really is, I'd roll my own using more specific frameworks for the features you mentioned (caching, logging, etc.) and AutoMapper.
ps. while there might be frameworks that do what you need, none come to my mind at the time.
Maybe I am missing something, but can't you just use the web service's WSDL files to generate your client side proxy code for the service.
精彩评论