| ADO NET 2 0 Object Mapper - Multi-table queries |
| Mike MacDonald posted at Tuesday, July 04, 2006 8:07 PM |
|
After reading the Readme file and the .NET 2.0 generics article, I'm still a tad confused when it comes to using the generated classes for stored procedures that have multiple table queries. I'm hoping that someone will be able to clarify.
Let's say, for example, a database has two tables - TableA and TableB and a stored procedure - ProcX, which uses both tables in a select query.
The ADO.NET Object Mapper will generate the data classes (TableA.cs, TableB.cs) and associated interfaces (ITableA.cs, ITableB.cs) for the tables. These can be placed into an assembly named DataTransfer. The mapper will also generate a class for the stored procedure (ProcX.cs) and a wrapper for the stored procedure (also named ProcX.cs), both of which can be placed into an assembly named Database. The Database assembly references the DataTransfer assembly as well as another assembly named BusinessRules (which also references the DataTransfer assembly).
In the BusinessRules assembly, I create a new class named Result. If ProcX only queried from TableA, then this Result class would inherit DataTransfer.Tables.TableA and the user interface layer could then use the Result class when retrieving a generic list or DataTable. However, ProcX queries from both TableA and TableB and the Result class can’t inherit both.
So, what must I do in the Result class to make it work with ProcX and properly use the TableA and TableB classes (let’s say the query is selecting ColA1, ColA2, ColA3 from TableA and ColB6, ColB7 from TableB where TableB.ColB2 = TableA.ColA1)? |
| Reply Reply Using Power Editor |
| |
| |
Rank |
Winnings |
Points |
| February |
0 |
$0.00 |
0 |
| January |
0 |
$0.00 |
0 |
|
|
|
|
|
|
|
|
|
Didn't Find The Answer You Were Looking For? |
| EggHeadCafe has experts online right now that may know the answer to your question. We pay them a bonus for answering as many questions as they can. So, why not help them and yourself by becoming a member (free) and ask them your question right now? |
| Ask Question In Live Forum |
|
| If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application. |
| Ask Question In Chat Chaos |
|