I am looking for some sort of tool to help with calling Oracle stored procedures from .Net code. We have a large legacy database that is frankly a bit messy (no id fields, large composite keys and duplicate data). Currently, we have to do do all data access via stored procedures through a custom library that is old and buggy and I would like to replace it.
I have some experience with ORM tools like nHibernate but after playing around with it a bit in our environment it doesn’t really seem to be the best option for working with a legacy database like this.
Does anyone know of a good tool that will allow stored procedures to be called easily and map the results into sets/collections of objects? A nice bonus would be the ability to handle connections transactions as well.
Thanks
The new Oracle beta Entity Framework driver lets you do that. You can map SPs into the model and either to entities (if they return the equivalent of a table) or create a “complex type” which is a class built around what the SP returns.
I don’t know how many SPs your calling, but for the ones I’ve tried it’s worked out.
Another option is to write your own library that just calls the procedures and returns the results as .net classes, but that will require a lot of setup work on your part in terms of repetitive code (mapping parameters to procedures in Oracle gets tedious real fast).
edit – Here’s a config file entry to use a stored procedure where the results are coming from a cursor that’s an OUT parameter.
edit 2 – And the stored procedure in question: