Hi,
I have a situation where I need to convert business objects to a flat table.
The reverse is also required. I am using c# and
Oracle ODP. I am looking for an easier method to do the below steps.
Steps I follows for populating Business Objects is as follows
(1) Get a list of records containing various tables joined together from DB
using a single PL/SQL
(This is a specific requirement, So cannot change the design)
Data will be redundent as shown below.
eg:- COLUMNS
ParentTable.Id, ParentTable.Name, ChildTable1.Id,
ChildTable1.Name, ChildTable2.Id, ChildTable2.Name
Sample data with respect to the above columns
1 "A" 1 "a" 1 "aa"
1 "A" 1 "a" 2 "bb"
1 "A" 2 "b" 1 "aa"
1 "A" 2 "b" 2 "bb"
1 "A" 2 "b" 3 "cc"
1 "A" 3 "c" 1 "bb"
(2) Iterate through each row and applying logic to separate data required to
build Buiness object
Eg., of business object :-
ParentClass
{
//contains collection of child 1
}
Child1_Class
{
//contains Collection of child 2
}
The reverse of this process is done to update/insert records from Buiness
objects.
My requirement is, to know whether there's any mechanism by which i can
convert
Business objects to Flat Table (DataTable) and Viceversa.
Looking for suggestions
Shibu 5 3115
Shibu,
You will have to provide the mapping yourself. This is the reason for
data layers. Your objects will have to expose a mechanism by which they can
say "this value should go in column x of table y".
You could use reflection, and name the fields internally to match the
columns, and the type to match the table, but I think that wouldn't be a
good idea.
I recommend using an attribute. You can create a TableAttribute, which
is applied to the class. Then, you can search through your types for the
class that has the table attribute with a table name that matches the table
part of the column. Once you have that, you can have a ColumnAttribute
class which will indicate which field in the class should be populated with
that value from the table.
Then, when storing the values back, you can use reflection just the same
to determine which columns in which tables are to be written to.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I have a situation where I need to convert business objects to a flat table. The reverse is also required. I am using c# and Oracle ODP. I am looking for an easier method to do the below steps.
Steps I follows for populating Business Objects is as follows (1) Get a list of records containing various tables joined together from DB using a single PL/SQL (This is a specific requirement, So cannot change the design)
Data will be redundent as shown below.
eg:- COLUMNS ParentTable.Id, ParentTable.Name, ChildTable1.Id, ChildTable1.Name, ChildTable2.Id, ChildTable2.Name
Sample data with respect to the above columns
1 "A" 1 "a" 1 "aa" 1 "A" 1 "a" 2 "bb" 1 "A" 2 "b" 1 "aa" 1 "A" 2 "b" 2 "bb" 1 "A" 2 "b" 3 "cc" 1 "A" 3 "c" 1 "bb"
(2) Iterate through each row and applying logic to separate data required to build Buiness object Eg., of business object :-
ParentClass { //contains collection of child 1
}
Child1_Class { //contains Collection of child 2 } The reverse of this process is done to update/insert records from Buiness objects.
My requirement is, to know whether there's any mechanism by which i can convert Business objects to Flat Table (DataTable) and Viceversa.
Looking for suggestions Shibu
Hi Nicholas ,
Thanks for your reply.. As you were saying, using attribute mapping can make
the whole thing bit easy.
In addition to using attributes, I guess I am looking for a logic to
implement it using a single query containing multiple table joins.
Like looping through each record to fill child class collections (tree).
And while inserting/updating data I have to iterate through each child class
collection and making PL/SQL call using each row data.
(I am not sure about calling ORACLE PL/SQL with fields as parameters
instead of a set of records)
Any suggestions...
Shibu
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uG**************@TK2MSFTNGP14.phx.gbl... Shibu,
You will have to provide the mapping yourself. This is the reason for data layers. Your objects will have to expose a mechanism by which they
can say "this value should go in column x of table y".
You could use reflection, and name the fields internally to match the columns, and the type to match the table, but I think that wouldn't be a good idea.
I recommend using an attribute. You can create a TableAttribute,
which is applied to the class. Then, you can search through your types for the class that has the table attribute with a table name that matches the
table part of the column. Once you have that, you can have a ColumnAttribute class which will indicate which field in the class should be populated
with that value from the table.
Then, when storing the values back, you can use reflection just the
same to determine which columns in which tables are to be written to.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I have a situation where I need to convert business objects to a flat table. The reverse is also required. I am using c# and Oracle ODP. I am looking for an easier method to do the below steps.
Steps I follows for populating Business Objects is as follows (1) Get a list of records containing various tables joined together from DB using a single PL/SQL (This is a specific requirement, So cannot change the design)
Data will be redundent as shown below.
eg:- COLUMNS ParentTable.Id, ParentTable.Name, ChildTable1.Id, ChildTable1.Name, ChildTable2.Id, ChildTable2.Name
Sample data with respect to the above columns
1 "A" 1 "a" 1 "aa" 1 "A" 1 "a" 2 "bb" 1 "A" 2 "b" 1 "aa" 1 "A" 2 "b" 2 "bb" 1 "A" 2 "b" 3 "cc" 1 "A" 3 "c" 1 "bb"
(2) Iterate through each row and applying logic to separate data
required to build Buiness object Eg., of business object :-
ParentClass { //contains collection of child 1
}
Child1_Class { //contains Collection of child 2 } The reverse of this process is done to update/insert records from
Buiness objects.
My requirement is, to know whether there's any mechanism by which i can convert Business objects to Flat Table (DataTable) and Viceversa.
Looking for suggestions Shibu
Shibu,
Writing the logic for creating all of those joins is going to be quite a
task. The problem is that for every child object in your heiarchy, you are
adding overhead at an exponential rate.
For that part, if I had to do it that way (and I most definitely would
not do it that way), I would check the relationships in the tables. For
each child table, I would query the database structure for the relationship
between the parent/child tables, and then construct the join statement based
on that information, while selecting all of the fields from all of the
tables.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message
news:Oh**************@TK2MSFTNGP14.phx.gbl... Hi Nicholas ,
Thanks for your reply.. As you were saying, using attribute mapping can make the whole thing bit easy. In addition to using attributes, I guess I am looking for a logic to implement it using a single query containing multiple table joins. Like looping through each record to fill child class collections (tree).
And while inserting/updating data I have to iterate through each child class collection and making PL/SQL call using each row data. (I am not sure about calling ORACLE PL/SQL with fields as parameters instead of a set of records)
Any suggestions... Shibu
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uG**************@TK2MSFTNGP14.phx.gbl... Shibu,
You will have to provide the mapping yourself. This is the reason for data layers. Your objects will have to expose a mechanism by which they can say "this value should go in column x of table y".
You could use reflection, and name the fields internally to match the columns, and the type to match the table, but I think that wouldn't be a good idea.
I recommend using an attribute. You can create a TableAttribute, which is applied to the class. Then, you can search through your types for the class that has the table attribute with a table name that matches the table part of the column. Once you have that, you can have a ColumnAttribute class which will indicate which field in the class should be populated with that value from the table.
Then, when storing the values back, you can use reflection just the same to determine which columns in which tables are to be written to.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... > Hi, > I have a situation where I need to convert business objects to a flat > table. > The reverse is also required. I am using c# and > Oracle ODP. I am looking for an easier method to do the below steps. > > Steps I follows for populating Business Objects is as follows > (1) Get a list of records containing various tables joined together > from > DB > using a single PL/SQL > (This is a specific requirement, So cannot change the design) > > Data will be redundent as shown below. > > eg:- COLUMNS > ParentTable.Id, ParentTable.Name, ChildTable1.Id, > ChildTable1.Name, ChildTable2.Id, ChildTable2.Name > > Sample data with respect to the above columns > > 1 "A" 1 "a" 1 "aa" > 1 "A" 1 "a" 2 "bb" > 1 "A" 2 "b" 1 "aa" > 1 "A" 2 "b" 2 "bb" > 1 "A" 2 "b" 3 "cc" > 1 "A" 3 "c" 1 "bb" > > (2) Iterate through each row and applying logic to separate data required > to > build Buiness object > Eg., of business object :- > > ParentClass > { > //contains collection of child 1 > > } > > Child1_Class > { > //contains Collection of child 2 > } > > > > The reverse of this process is done to update/insert records from Buiness > objects. > > My requirement is, to know whether there's any mechanism by which i can > convert > Business objects to Flat Table (DataTable) and Viceversa. > > Looking for suggestions > Shibu > >
Nicholas,
I have PL/SQL query which returns all the fields. But the problem I face is,
it is tedious to construct the
logic to convert the records back to business object heirarchy. Extracting
data from business objects
to give to PL/SQL is also tedious and have to use lot of logical checkings.
So I think, because of bad design, I have to go through all logic
implementation for each business objects
and no other way around right? :(
Any way thanks for you suggestions...
Shibu
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oa**************@TK2MSFTNGP09.phx.gbl... Shibu,
Writing the logic for creating all of those joins is going to be quite
a task. The problem is that for every child object in your heiarchy, you
are adding overhead at an exponential rate.
For that part, if I had to do it that way (and I most definitely would not do it that way), I would check the relationships in the tables. For each child table, I would query the database structure for the
relationship between the parent/child tables, and then construct the join statement
based on that information, while selecting all of the fields from all of the tables.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message news:Oh**************@TK2MSFTNGP14.phx.gbl... Hi Nicholas ,
Thanks for your reply.. As you were saying, using attribute mapping can make the whole thing bit easy. In addition to using attributes, I guess I am looking for a logic to implement it using a single query containing multiple table joins. Like looping through each record to fill child class collections (tree).
And while inserting/updating data I have to iterate through each child class collection and making PL/SQL call using each row data. (I am not sure about calling ORACLE PL/SQL with fields as parameters instead of a set of records)
Any suggestions... Shibu
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uG**************@TK2MSFTNGP14.phx.gbl... Shibu,
You will have to provide the mapping yourself. This is the reason for data layers. Your objects will have to expose a mechanism by which
they can say "this value should go in column x of table y".
You could use reflection, and name the fields internally to match
the columns, and the type to match the table, but I think that wouldn't be
a good idea.
I recommend using an attribute. You can create a TableAttribute, which is applied to the class. Then, you can search through your types for
the class that has the table attribute with a table name that matches the table part of the column. Once you have that, you can have a ColumnAttribute class which will indicate which field in the class should be populated with that value from the table.
Then, when storing the values back, you can use reflection just the same to determine which columns in which tables are to be written to.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... > Hi, > I have a situation where I need to convert business objects to a flat > table. > The reverse is also required. I am using c# and > Oracle ODP. I am looking for an easier method to do the below steps. > > Steps I follows for populating Business Objects is as follows > (1) Get a list of records containing various tables joined together > from > DB > using a single PL/SQL > (This is a specific requirement, So cannot change the design) > > Data will be redundent as shown below. > > eg:- COLUMNS > ParentTable.Id, ParentTable.Name, ChildTable1.Id, > ChildTable1.Name, ChildTable2.Id, ChildTable2.Name > > Sample data with respect to the above columns > > 1 "A" 1 "a" 1 "aa" > 1 "A" 1 "a" 2 "bb" > 1 "A" 2 "b" 1 "aa" > 1 "A" 2 "b" 2 "bb" > 1 "A" 2 "b" 3 "cc" > 1 "A" 3 "c" 1 "bb" > > (2) Iterate through each row and applying logic to separate data required > to > build Buiness object > Eg., of business object :- > > ParentClass > { > //contains collection of child 1 > > } > > Child1_Class > { > //contains Collection of child 2 > } > > > > The reverse of this process is done to update/insert records from Buiness > objects. > > My requirement is, to know whether there's any mechanism by which i
can > convert > Business objects to Flat Table (DataTable) and Viceversa. > > Looking for suggestions > Shibu > >
Hi ,
There have been several threads here regarding this, and some poster have
send links for utilities that perform/help this conversion, take a look at
the archives and you will find them.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Shibu" <sh*****@yahoo.com> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl... Nicholas,
I have PL/SQL query which returns all the fields. But the problem I face is, it is tedious to construct the logic to convert the records back to business object heirarchy. Extracting data from business objects to give to PL/SQL is also tedious and have to use lot of logical checkings.
So I think, because of bad design, I have to go through all logic implementation for each business objects and no other way around right? :(
Any way thanks for you suggestions... Shibu "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:Oa**************@TK2MSFTNGP09.phx.gbl... Shibu,
Writing the logic for creating all of those joins is going to be quite a task. The problem is that for every child object in your heiarchy, you are adding overhead at an exponential rate.
For that part, if I had to do it that way (and I most definitely would not do it that way), I would check the relationships in the tables. For each child table, I would query the database structure for the relationship between the parent/child tables, and then construct the join statement based on that information, while selecting all of the fields from all of the tables.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Shibu" <sh*****@yahoo.com> wrote in message news:Oh**************@TK2MSFTNGP14.phx.gbl... > Hi Nicholas , > > Thanks for your reply.. As you were saying, using attribute mapping can > make > the whole thing bit easy. > In addition to using attributes, I guess I am looking for a logic to > implement it using a single query containing multiple table joins. > Like looping through each record to fill child class collections > (tree). > > And while inserting/updating data I have to iterate through each child > class > collection and making PL/SQL call using each row data. > (I am not sure about calling ORACLE PL/SQL with fields as parameters > instead of a set of records) > > Any suggestions... > Shibu > > > "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> > wrote > in > message news:uG**************@TK2MSFTNGP14.phx.gbl... >> Shibu, >> >> You will have to provide the mapping yourself. This is the reason >> for >> data layers. Your objects will have to expose a mechanism by which they > can >> say "this value should go in column x of table y". >> >> You could use reflection, and name the fields internally to match the >> columns, and the type to match the table, but I think that wouldn't be a >> good idea. >> >> I recommend using an attribute. You can create a TableAttribute, > which >> is applied to the class. Then, you can search through your types for the >> class that has the table attribute with a table name that matches the > table >> part of the column. Once you have that, you can have a >> ColumnAttribute >> class which will indicate which field in the class should be populated > with >> that value from the table. >> >> Then, when storing the values back, you can use reflection just >> the > same >> to determine which columns in which tables are to be written to. >> >> Hope this helps. >> >> >> -- >> - Nicholas Paldino [.NET/C# MVP] >> - mv*@spam.guard.caspershouse.com >> >> >> "Shibu" <sh*****@yahoo.com> wrote in message >> news:%2****************@TK2MSFTNGP14.phx.gbl... >> > Hi, >> > I have a situation where I need to convert business objects to a >> > flat >> > table. >> > The reverse is also required. I am using c# and >> > Oracle ODP. I am looking for an easier method to do the below steps. >> > >> > Steps I follows for populating Business Objects is as follows >> > (1) Get a list of records containing various tables joined together >> > from >> > DB >> > using a single PL/SQL >> > (This is a specific requirement, So cannot change the design) >> > >> > Data will be redundent as shown below. >> > >> > eg:- COLUMNS >> > ParentTable.Id, ParentTable.Name, ChildTable1.Id, >> > ChildTable1.Name, ChildTable2.Id, ChildTable2.Name >> > >> > Sample data with respect to the above columns >> > >> > 1 "A" 1 "a" 1 "aa" >> > 1 "A" 1 "a" 2 "bb" >> > 1 "A" 2 "b" 1 "aa" >> > 1 "A" 2 "b" 2 "bb" >> > 1 "A" 2 "b" 3 "cc" >> > 1 "A" 3 "c" 1 "bb" >> > >> > (2) Iterate through each row and applying logic to separate data > required >> > to >> > build Buiness object >> > Eg., of business object :- >> > >> > ParentClass >> > { >> > //contains collection of child 1 >> > >> > } >> > >> > Child1_Class >> > { >> > //contains Collection of child 2 >> > } >> > >> > >> > >> > The reverse of this process is done to update/insert records from > Buiness >> > objects. >> > >> > My requirement is, to know whether there's any mechanism by which i can >> > convert >> > Business objects to Flat Table (DataTable) and Viceversa. >> > >> > Looking for suggestions >> > Shibu >> > >> > >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chris Brown |
last post by:
Hello,
I work for a company that sells a product with a VFP frontend/MSSQL backend,
and we have become aware for many reasons the we need to switch over to
..net. The problem is that our...
|
by: Shibu |
last post by:
Hi,
I have a situation where I need to convert business objects to a flat table.
The reverse is also required. I am using c# and Oracle ODP. I am looking for
an easier method to do the below...
|
by: deko |
last post by:
I've been trying to use the Access Import Wizard to expedite importing data
into my mdb. The nice thing about the wizard is that I can import from
different file formats - txt, xls, even Outlook -...
|
by: Daisy |
last post by:
Hi Folks,
Got a load of business objects - Product, Price, Offer, FAQ, Description...
Product contains collections of the others (eg. Product.Offers is a
collection of Offer objects)
...
|
by: Hasan O. Zavalsiz |
last post by:
Hi , i am trying to figure out which approach is better to use .
let me explain the scenario.
i am using the "Nortwind" database . in this database i have "Customers "
table .The following is the...
|
by: D Witherspoon |
last post by:
I am developing a Windows Forms application in VB.NET that will use .NET
remoting to access the data tier classes.
A very simple way I have come up with is by creating typed (.xsd) datasets.
For...
|
by: Penelope Dramas |
last post by:
Hello,
I'm in a front of very serious .net redesign/rewrite of an old VB6
application.
I had been asked to make it .NET 2.0 and would like to ask couple of
questions regarding data access as...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |