Print Page | Close Window

DataTable with the Employee class members

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=556
Printed Date: 20-Oct-2025 at 4:54am


Topic: DataTable with the Employee class members
Posted By: gussabina
Subject: DataTable with the Employee class members
Date Posted: 19-Nov-2007 at 11:45pm
Hi All:
I would need to create a new DataTable with all datamembers from the Employee class (IdeaBlade Tutorial Database). I mean, just a single table with the employee table data and the related entities , such the home address. It is possible? How to do it?
 
Thanks in Advance!
Gus



Replies:
Posted By: davidklitzke
Date Posted: 21-Nov-2007 at 11:54am
Please don't try to use the underlying DataTable from ADO.NET.  This is not a public API that we advertise.  Rather it is an implementation detail that could change in future versions of our product.
 
Developers who are new to DevForce often find it hard to shake old habits and prejudices.  For example, many developers ask us how to create a join of one table with some related tables.  We try to show these developers that joins are quite unnecessary.  Just use the tables as they are and use relations to get the related information.  There are many examples in the tutorials that use complex and interrelated tables, and nowhere do we do any table joins.
 
The question that I would ask you is why do you want to put the data in a single table. For example, to get the Employee's Address, we use a relation.  We use "Employee.Address" and two tables, an Employee table and an Address table.  I think what you want is one table, i.e., an Employee table with an added Address Column.  Note, however, that we still use the same expression to get the Address, i.e., "Employee.Address" so we haven't made it any easier for the developer to write his code, and meanwhile we've added more work for the DBA.  Someone has to create the joined table.
 


Posted By: gussabina
Date Posted: 22-Nov-2007 at 10:47am
Yes. David:
You are right... The way IdeaBlade handle relations is excellent! The only concerns is that I have to interface with others tools in order to use their presentations tools for reports and so on...An they require just a single table with all the data. So if I have the Employee data and their related data, I would need to be able to copy all this data into just one table...
 
Thanks


Posted By: davidklitzke
Date Posted: 22-Nov-2007 at 11:22pm
Just make custom properties for your relational properties.  For example, for the home address of an Employee make a custom property name HomeAddress.  Unfortunately, while this will work for some reporting tools like DevExpress XtraReports, it doesn't work for other tools such as Crystal Reports.
 
If you have to work with a reporting tool that won't accept relational properties, you might try using a view.  You can also build a Stored Procedure backed entity that is essentially a join of your Employee table with some other tables. 
 
Just because our first answer to your question was that you shouldn't have to use a join, we do, in fact, work quite nicely with table joins!



Print Page | Close Window