Reputation: 12359
Here's the situation.
We have a 3rd party middleware (using SQLServer as a back-end) which we communicate with using an HTTP service link and XMLRPC-like messaging.
The service always returns a dataset as results of any commands that returns something. There is a way to pass an embedded SQL statement to the service.
So, we do not have a direct access to the database.
I'm trying to isolate this service with a layer that would simplify access. I was thinking of using an ORM like NHibernate.
Is this scenario supported by NHibernate or does NH always needs a direct access to the database?
If you have any other suggestions I'm all ears open...
Upvotes: 0
Views: 103
Reputation: 116
We use NHibernate and it sucks. I would not recommend it for anything. As for as I know, NHibernate does require direct access to the database (or at least you just give NHibernate a connection string like you would any other data access provider). Also, because of that, I'm pretty sure it won't know how to handle Xml datasets.
Upvotes: 0
Reputation: 10225
If I understand you correctly, you're forced to use the 3rd party middle-ware - but it's not easy to deal with?
I've never used NHibernate so I can't speak for that.
Sounds like you want to add a new "service layer" (for want of a better term) on the top that's easier to deal with; the Facade pattern leaps to mind (although that's often used to bundle up a variety of different and disparate interfaces underneath a single cohesive integration point).
Basically you want to define a nice clean set of interfaces / services (in the new service layer); this new layer will then do all the hard work of interacting with the middle-ware - or with the database directly if you get the chance.
I would also suggest making this new layer into a couple of sub-parts: you don't want to go and build a new layer that's tightly coupled to the middle-ware (or database) - use Dependency Injection to isolate the outer facade from the concrete implementation, and maintain loose coupling. That way if the middle-ware disappears you won't directly impact consumers of the new service layer you've built.
Lastly, keep the Interface Segregation Principle (ISP) in mind when designing the new externally facing services.
Free Image Hosting http://www.freeimagehosting.net/uploads/89e5a8a47a.jpg (Full size image here)
Upvotes: 1