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.Nam e, ChildTable1.Id,
ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e
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 3128
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.co m
"Shibu" <sh*****@yahoo. com> wrote in message
news:%2******** ********@TK2MSF TNGP14.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.Nam e, ChildTable1.Id, ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e
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.c om> wrote in
message news:uG******** ******@TK2MSFTN GP14.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.co m
"Shibu" <sh*****@yahoo. com> wrote in message news:%2******** ********@TK2MSF TNGP14.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.Nam e, ChildTable1.Id, ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e
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.co m
"Shibu" <sh*****@yahoo. com> wrote in message
news:Oh******** ******@TK2MSFTN GP14.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.c om> wrote in message news:uG******** ******@TK2MSFTN GP14.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.co m
"Shibu" <sh*****@yahoo. com> wrote in message news:%2******** ********@TK2MSF TNGP14.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.Nam e, ChildTable1.Id, > ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e > > 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.c om> wrote in
message news:Oa******** ******@TK2MSFTN GP09.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.co m
"Shibu" <sh*****@yahoo. com> wrote in message news:Oh******** ******@TK2MSFTN GP14.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.c om> wrote in message news:uG******** ******@TK2MSFTN GP14.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.co m
"Shibu" <sh*****@yahoo. com> wrote in message news:%2******** ********@TK2MSF TNGP14.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.Nam e, ChildTable1.Id, > ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e > > 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******** ******@TK2MSFTN GP12.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.c om> wrote in message news:Oa******** ******@TK2MSFTN GP09.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.co m
"Shibu" <sh*****@yahoo. com> wrote in message news:Oh******** ******@TK2MSFTN GP14.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.c om> > wrote > in > message news:uG******** ******@TK2MSFTN GP14.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.co m >> >> >> "Shibu" <sh*****@yahoo. com> wrote in message >> news:%2******** ********@TK2MSF TNGP14.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.Nam e, ChildTable1.Id, >> > ChildTable1.Nam e, ChildTable2.Id, ChildTable2.Nam e >> > >> > 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 application is huge, and a flatout conversion
would take several years, during which time our core product would change.
It appears our best approach would is a gradual conversion from VFP to .net.
Has anyone faced and solved this challenge before? Any...
|
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 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)
|
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 - and dump everything into a
table.
The problem is once I have the data imported into a new table, I can't do
much with it. If I try to run an Append query and insert data from the new
table into an existing table, the query fails - "Error...
|
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)
Similarly, in the database, Price, Offer, Faq, Description all have Product
foreign keys (and there can be multiple of all except Price (it's in its own
table for other reasons)).
|
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 two different ways to handle this table.
CASE 1 :
create a struct that encaplusates table "Customers" columns
public struct structCustomers
{
public string CustomerID;
| |
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 example dsParts.xsd and including that in the data tier. I then will
create a class that looks like this
Public Class CPart
Inherits dsParts
|
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 this application is heavily data-centric
around MSDE database.
Would it be better to use custom business objects or extend
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |