Thursday, March 29, 2012

Object Null Reference Exception (vb)

Can someone tell me what this compiler error means?
Using VS.NET 2002/VB

----------------
Dim objFIF As New RMClassLib.FtInFr()

objFIF.CreateNewFIF(False, False, 3, 24)

pitchInDrp.DataSource = objFIF.GetNewFIF

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Line 133: Dim objFIF As New RMClassLib.FtInFr()
-----------------

Thanks,
GeorgeIgnore that request for help. I think I have it figured out.

Thanks.
George

"George" <--@.--.--> wrote in message
news:4L0Sb.30723$6O4.823971@.bgtnsc04-news.ops.worldnet.att.net...
> Can someone tell me what this compiler error means?
> Using VS.NET 2002/VB
> ----------------
> Dim objFIF As New RMClassLib.FtInFr()
> objFIF.CreateNewFIF(False, False, 3, 24)
> pitchInDrp.DataSource = objFIF.GetNewFIF
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
> Line 133: Dim objFIF As New RMClassLib.FtInFr()
> -----------------
> Thanks,
> George

Object Oriented / App Design Question

I am designing a web application in asp.net C#, and I created classes (in
.cs files) working with the .aspx pages. Now, for database part...
wondering which way is better:
1. put database connectivity in the Classes, each class has the load/save
data method? Many of my classes are inherited from each other, and since I
am using SQL 2000 which is a relational database makes the job little bit
more complicated.
2. put database connectivity in .aspx pages, then get/put the data from/into
the classes when needed? This sounds easier, but is it a bad design?
Any suggestions are welcome.. thanksOOAD normally involves slightly more work but has great deal of advantages
in terms of breaking the system down into manageable chunks.
Consider a page where you have user login, registration, profile view and
edit etc. They all related to all users and potentially have independant UI.
So you would have say 4 aspx pages with code behind. But to directly access
the database from those codebehind classes doesnt help code reuse like if
you needed the same data somewhere else.. in that case you would be
repeating the code. So you create a Middletier which essentially channels
call. So all you aspx pages would do is call the middle tier class to get
the data..
The middle tier classes could implement the logic to connect to the database
and fetch the data which you return to the calling function. that way your
aspx page is not way concerned on whether you are using access or sql server
or msde or oracle or sybase. You could go further and use generic data
access block like the one from MS which lets you connect and do queries on
ms sql 7 or above. That way if you change the database all you have to
change is the middle-tier and replace the calls with new library class..
ASPX ==> codebehind for presentation logic >> Middle tier >> Data Access
Tier >> Database. Read up a bit on layed / tiered application design..
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> I am designing a web application in asp.net C#, and I created classes (in
> .cs files) working with the .aspx pages. Now, for database part...
> wondering which way is better:
> 1. put database connectivity in the Classes, each class has the load/save
> data method? Many of my classes are inherited from each other, and since I
> am using SQL 2000 which is a relational database makes the job little bit
> more complicated.
> 2. put database connectivity in .aspx pages, then get/put the data
from/into
> the classes when needed? This sounds easier, but is it a bad design?
> Any suggestions are welcome.. thanks
>
>
I am not sure I like either. One methodology that works well is the creation
of a persistance layer that controls marshalling the business objects from
the database to your app. You have methods in the class that force the
callback, but the object-relation mapping engine (persistence layer part) is
actually aware of how to get the data back. This is a better OO design, and
you can find examples on open source sites like SourceForge (including
code).
Rockford Lhotka has his own design of a data "persistance" type of engine
that looks promising. It is in both his VB.NET and C# objects books. You can
download the code and adopt it for your site.
Finally, ObjectSpaces will be out in a future Visual Studio. It allows
mapping via an XML Schema. Unfortunately, it has been dumped from Whidbey
timeframe, but you can still get the March preview and play around with the
idea. If you can get a similar method, you will be ready when objectspaces
are finally available.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
****************************************
*********
Think outside the box!
****************************************
*********
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
>I am designing a web application in asp.net C#, and I created classes (in
> .cs files) working with the .aspx pages. Now, for database part...
> wondering which way is better:
> 1. put database connectivity in the Classes, each class has the load/save
> data method? Many of my classes are inherited from each other, and since I
> am using SQL 2000 which is a relational database makes the job little bit
> more complicated.
> 2. put database connectivity in .aspx pages, then get/put the data
> from/into
> the classes when needed? This sounds easier, but is it a bad design?
> Any suggestions are welcome.. thanks
>
>
Does that mean option (1) is better? To be specific, the Classes I wrote
can be act as middle tier, and they all get compiled as .dll put in the
/bin.
"Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
news:%23iXugImoEHA.1776@.TK2MSFTNGP14.phx.gbl...
> OOAD normally involves slightly more work but has great deal of advantages
> in terms of breaking the system down into manageable chunks.
> Consider a page where you have user login, registration, profile view and
> edit etc. They all related to all users and potentially have independant
UI.
> So you would have say 4 aspx pages with code behind. But to directly
access
> the database from those codebehind classes doesnt help code reuse like if
> you needed the same data somewhere else.. in that case you would be
> repeating the code. So you create a Middletier which essentially channels
> call. So all you aspx pages would do is call the middle tier class to get
> the data..
> The middle tier classes could implement the logic to connect to the
database
> and fetch the data which you return to the calling function. that way your
> aspx page is not way concerned on whether you are using access or sql
server
> or msde or oracle or sybase. You could go further and use generic data
> access block like the one from MS which lets you connect and do queries on
> ms sql 7 or above. That way if you change the database all you have to
> change is the middle-tier and replace the calls with new library class..
> ASPX ==> codebehind for presentation logic >> Middle tier >> Data Access
> Tier >> Database. Read up a bit on layed / tiered application design..
> --
> Regards,
> Hermit Dave
> (http://hdave.blogspot.com)
> "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
(in
load/save
I
bit
> from/into
>
well there are lots of techniques and all have their advantages and
divantages. What you use is based on
a. how much seperation you want
b. the hassle you wouldnt mind going into.
I would say that option 1 isnt bad... though you could still drill further
down to increase the seperation.
consider thing.. from every class that access database you will start by
getting the connection string and creating a connection etc. You break that
down further but you have to decide on factors A & B.
You want to look up on what Greg mentioned as well..
Regards,
Hermit Dave
(http://hdave.blogspot.com)
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:o-mdnbvzwqv89cncRVn-qQ@.rogers.com...
> Does that mean option (1) is better? To be specific, the Classes I wrote
> can be act as middle tier, and they all get compiled as .dll put in the
> /bin.
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:%23iXugImoEHA.1776@.TK2MSFTNGP14.phx.gbl...
advantages
and
> UI.
> access
if
channels
get
> database
your
> server
on
> (in
> load/save
since
> I
> bit
>
Is this the book I should read?
http://www.amazon.com/exec/obidos/t...=gla
nce
I am going to buy if this is the one... Thanks a lot.
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
> I am not sure I like either. One methodology that works well is the
creation
> of a persistance layer that controls marshalling the business objects from
> the database to your app. You have methods in the class that force the
> callback, but the object-relation mapping engine (persistence layer part)
is
> actually aware of how to get the data back. This is a better OO design,
and
> you can find examples on open source sites like SourceForge (including
> code).
> Rockford Lhotka has his own design of a data "persistance" type of engine
> that looks promising. It is in both his VB.NET and C# objects books. You
can
> download the code and adopt it for your site.
> Finally, ObjectSpaces will be out in a future Visual Studio. It allows
> mapping via an XML Schema. Unfortunately, it has been dumped from Whidbey
> timeframe, but you can still get the March preview and play around with
the
> idea. If you can get a similar method, you will be ready when objectspaces
> are finally available.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ****************************************
*********
> Think outside the box!
> ****************************************
*********
> "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
load/save
I
bit
>
Hi,
This is a fantastic read and it is free:
http://msdn.microsoft.com/architect...ns/html/Esp.asp
There are also many other patterns and practices that you will benefit from
reading. Understanding these will give you most of the design information
you will need for creating powerful applications. Good luck! Ken.
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:6d6dnSCkfaiQ6cncRVn-pg@.rogers.com...
> Is this the book I should read?
>
http://www.amazon.com/exec/obidos/t...738524?v=glance[color
=darkred]
> I am going to buy if this is the one... Thanks a lot.
>
>
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
> message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
> creation
from
part)
> is
> and
engine
> can
Whidbey
> the
objectspaces
(in
> load/save
since
> I
> bit
>
I use Rocky's CLSA framework in a large ASP.Net.
It works great. The book is one of the best "reads" out there.
There is a whole Users forum available for discussing how to implement CSLA.
http://groups.msn.com/CSLANET/messages.msnw
Petar Kozul has added some *amazing* extensions to the framework with his
ActiveObjects.
http://csla.kozul.info/
--
Joe Fallon
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:6d6dnSCkfaiQ6cncRVn-pg@.rogers.com...
> Is this the book I should read?
> http://www.amazon.com/exec/obidos/t...=g
lance
> I am going to buy if this is the one... Thanks a lot.
>
>
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
> message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
> creation
> is
> and
> can
> the
> load/save
> I
> bit
>

Object Oriented / App Design Question

I am designing a web application in asp.net C#, and I created classes (in
..cs files) working with the .aspx pages. Now, for database part...
wondering which way is better:

1. put database connectivity in the Classes, each class has the load/save
data method? Many of my classes are inherited from each other, and since I
am using SQL 2000 which is a relational database makes the job little bit
more complicated.

2. put database connectivity in .aspx pages, then get/put the data from/into
the classes when needed? This sounds easier, but is it a bad design?

Any suggestions are welcome.. thanksOOAD normally involves slightly more work but has great deal of advantages
in terms of breaking the system down into manageable chunks.

Consider a page where you have user login, registration, profile view and
edit etc. They all related to all users and potentially have independant UI.
So you would have say 4 aspx pages with code behind. But to directly access
the database from those codebehind classes doesnt help code reuse like if
you needed the same data somewhere else.. in that case you would be
repeating the code. So you create a Middletier which essentially channels
call. So all you aspx pages would do is call the middle tier class to get
the data..

The middle tier classes could implement the logic to connect to the database
and fetch the data which you return to the calling function. that way your
aspx page is not way concerned on whether you are using access or sql server
or msde or oracle or sybase. You could go further and use generic data
access block like the one from MS which lets you connect and do queries on
ms sql 7 or above. That way if you change the database all you have to
change is the middle-tier and replace the calls with new library class..

ASPX ==> codebehind for presentation logic >> Middle tier >> Data Access
Tier >> Database. Read up a bit on layed / tiered application design..

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> I am designing a web application in asp.net C#, and I created classes (in
> .cs files) working with the .aspx pages. Now, for database part...
> wondering which way is better:
> 1. put database connectivity in the Classes, each class has the load/save
> data method? Many of my classes are inherited from each other, and since I
> am using SQL 2000 which is a relational database makes the job little bit
> more complicated.
> 2. put database connectivity in .aspx pages, then get/put the data
from/into
> the classes when needed? This sounds easier, but is it a bad design?
> Any suggestions are welcome.. thanks
I am not sure I like either. One methodology that works well is the creation
of a persistance layer that controls marshalling the business objects from
the database to your app. You have methods in the class that force the
callback, but the object-relation mapping engine (persistence layer part) is
actually aware of how to get the data back. This is a better OO design, and
you can find examples on open source sites like SourceForge (including
code).

Rockford Lhotka has his own design of a data "persistance" type of engine
that looks promising. It is in both his VB.NET and C# objects books. You can
download the code and adopt it for your site.

Finally, ObjectSpaces will be out in a future Visual Studio. It allows
mapping via an XML Schema. Unfortunately, it has been dumped from Whidbey
timeframe, but you can still get the March preview and play around with the
idea. If you can get a similar method, you will be ready when objectspaces
are finally available.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
>I am designing a web application in asp.net C#, and I created classes (in
> .cs files) working with the .aspx pages. Now, for database part...
> wondering which way is better:
> 1. put database connectivity in the Classes, each class has the load/save
> data method? Many of my classes are inherited from each other, and since I
> am using SQL 2000 which is a relational database makes the job little bit
> more complicated.
> 2. put database connectivity in .aspx pages, then get/put the data
> from/into
> the classes when needed? This sounds easier, but is it a bad design?
> Any suggestions are welcome.. thanks
Does that mean option (1) is better? To be specific, the Classes I wrote
can be act as middle tier, and they all get compiled as .dll put in the
/bin.

"Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
news:%23iXugImoEHA.1776@.TK2MSFTNGP14.phx.gbl...
> OOAD normally involves slightly more work but has great deal of advantages
> in terms of breaking the system down into manageable chunks.
> Consider a page where you have user login, registration, profile view and
> edit etc. They all related to all users and potentially have independant
UI.
> So you would have say 4 aspx pages with code behind. But to directly
access
> the database from those codebehind classes doesnt help code reuse like if
> you needed the same data somewhere else.. in that case you would be
> repeating the code. So you create a Middletier which essentially channels
> call. So all you aspx pages would do is call the middle tier class to get
> the data..
> The middle tier classes could implement the logic to connect to the
database
> and fetch the data which you return to the calling function. that way your
> aspx page is not way concerned on whether you are using access or sql
server
> or msde or oracle or sybase. You could go further and use generic data
> access block like the one from MS which lets you connect and do queries on
> ms sql 7 or above. That way if you change the database all you have to
> change is the middle-tier and replace the calls with new library class..
> ASPX ==> codebehind for presentation logic >> Middle tier >> Data Access
> Tier >> Database. Read up a bit on layed / tiered application design..
> --
> Regards,
> Hermit Dave
> (http://hdave.blogspot.com)
> "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> > I am designing a web application in asp.net C#, and I created classes
(in
> > .cs files) working with the .aspx pages. Now, for database part...
> > wondering which way is better:
> > 1. put database connectivity in the Classes, each class has the
load/save
> > data method? Many of my classes are inherited from each other, and since
I
> > am using SQL 2000 which is a relational database makes the job little
bit
> > more complicated.
> > 2. put database connectivity in .aspx pages, then get/put the data
> from/into
> > the classes when needed? This sounds easier, but is it a bad design?
> > Any suggestions are welcome.. thanks
well there are lots of techniques and all have their advantages and
disadvantages. What you use is based on
a. how much seperation you want
b. the hassle you wouldnt mind going into.

I would say that option 1 isnt bad... though you could still drill further
down to increase the seperation.

consider thing.. from every class that access database you will start by
getting the connection string and creating a connection etc. You break that
down further but you have to decide on factors A & B.

You want to look up on what Greg mentioned as well..

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:o-mdnbvzwqv89cncRVn-qQ@.rogers.com...
> Does that mean option (1) is better? To be specific, the Classes I wrote
> can be act as middle tier, and they all get compiled as .dll put in the
> /bin.
>
> "Hermit Dave" <hermitd.REMOVE@.CAPS.AND.DOTS.hotmail.com> wrote in message
> news:%23iXugImoEHA.1776@.TK2MSFTNGP14.phx.gbl...
> > OOAD normally involves slightly more work but has great deal of
advantages
> > in terms of breaking the system down into manageable chunks.
> > Consider a page where you have user login, registration, profile view
and
> > edit etc. They all related to all users and potentially have independant
> UI.
> > So you would have say 4 aspx pages with code behind. But to directly
> access
> > the database from those codebehind classes doesnt help code reuse like
if
> > you needed the same data somewhere else.. in that case you would be
> > repeating the code. So you create a Middletier which essentially
channels
> > call. So all you aspx pages would do is call the middle tier class to
get
> > the data..
> > The middle tier classes could implement the logic to connect to the
> database
> > and fetch the data which you return to the calling function. that way
your
> > aspx page is not way concerned on whether you are using access or sql
> server
> > or msde or oracle or sybase. You could go further and use generic data
> > access block like the one from MS which lets you connect and do queries
on
> > ms sql 7 or above. That way if you change the database all you have to
> > change is the middle-tier and replace the calls with new library class..
> > ASPX ==> codebehind for presentation logic >> Middle tier >> Data Access
> > Tier >> Database. Read up a bit on layed / tiered application design..
> > --
> > Regards,
> > Hermit Dave
> > (http://hdave.blogspot.com)
> > "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> > news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> > > I am designing a web application in asp.net C#, and I created classes
> (in
> > > .cs files) working with the .aspx pages. Now, for database part...
> > > wondering which way is better:
> > > > 1. put database connectivity in the Classes, each class has the
> load/save
> > > data method? Many of my classes are inherited from each other, and
since
> I
> > > am using SQL 2000 which is a relational database makes the job little
> bit
> > > more complicated.
> > > > 2. put database connectivity in .aspx pages, then get/put the data
> > from/into
> > > the classes when needed? This sounds easier, but is it a bad design?
> > > > Any suggestions are welcome.. thanks
> > >
Is this the book I should read?

http://www.amazon.com/exec/obidos/t...738524?v=glance

I am going to buy if this is the one... Thanks a lot.

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
> I am not sure I like either. One methodology that works well is the
creation
> of a persistance layer that controls marshalling the business objects from
> the database to your app. You have methods in the class that force the
> callback, but the object-relation mapping engine (persistence layer part)
is
> actually aware of how to get the data back. This is a better OO design,
and
> you can find examples on open source sites like SourceForge (including
> code).
> Rockford Lhotka has his own design of a data "persistance" type of engine
> that looks promising. It is in both his VB.NET and C# objects books. You
can
> download the code and adopt it for your site.
> Finally, ObjectSpaces will be out in a future Visual Studio. It allows
> mapping via an XML Schema. Unfortunately, it has been dumped from Whidbey
> timeframe, but you can still get the March preview and play around with
the
> idea. If you can get a similar method, you will be ready when objectspaces
> are finally available.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> *************************************************
> Think outside the box!
> *************************************************
> "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> >I am designing a web application in asp.net C#, and I created classes (in
> > .cs files) working with the .aspx pages. Now, for database part...
> > wondering which way is better:
> > 1. put database connectivity in the Classes, each class has the
load/save
> > data method? Many of my classes are inherited from each other, and since
I
> > am using SQL 2000 which is a relational database makes the job little
bit
> > more complicated.
> > 2. put database connectivity in .aspx pages, then get/put the data
> > from/into
> > the classes when needed? This sounds easier, but is it a bad design?
> > Any suggestions are welcome.. thanks
Hi,

This is a fantastic read and it is free:
http://msdn.microsoft.com/architect...ns/html/Esp.asp

There are also many other patterns and practices that you will benefit from
reading. Understanding these will give you most of the design information
you will need for creating powerful applications. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight

"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:6d6dnSCkfaiQ6cncRVn-pg@.rogers.com...
> Is this the book I should read?
>
http://www.amazon.com/exec/obidos/t...738524?v=glance
> I am going to buy if this is the one... Thanks a lot.
>
>
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
> message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
> > I am not sure I like either. One methodology that works well is the
> creation
> > of a persistance layer that controls marshalling the business objects
from
> > the database to your app. You have methods in the class that force the
> > callback, but the object-relation mapping engine (persistence layer
part)
> is
> > actually aware of how to get the data back. This is a better OO design,
> and
> > you can find examples on open source sites like SourceForge (including
> > code).
> > Rockford Lhotka has his own design of a data "persistance" type of
engine
> > that looks promising. It is in both his VB.NET and C# objects books. You
> can
> > download the code and adopt it for your site.
> > Finally, ObjectSpaces will be out in a future Visual Studio. It allows
> > mapping via an XML Schema. Unfortunately, it has been dumped from
Whidbey
> > timeframe, but you can still get the March preview and play around with
> the
> > idea. If you can get a similar method, you will be ready when
objectspaces
> > are finally available.
> > --
> > Gregory A. Beamer
> > MVP; MCP: +I, SE, SD, DBA
> > *************************************************
> > Think outside the box!
> > *************************************************
> > "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
> > news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
> > >I am designing a web application in asp.net C#, and I created classes
(in
> > > .cs files) working with the .aspx pages. Now, for database part...
> > > wondering which way is better:
> > > > 1. put database connectivity in the Classes, each class has the
> load/save
> > > data method? Many of my classes are inherited from each other, and
since
> I
> > > am using SQL 2000 which is a relational database makes the job little
> bit
> > > more complicated.
> > > > 2. put database connectivity in .aspx pages, then get/put the data
> > > from/into
> > > the classes when needed? This sounds easier, but is it a bad design?
> > > > Any suggestions are welcome.. thanks
> > >
I use Rocky's CLSA framework in a large ASP.Net.
It works great. The book is one of the best "reads" out there.
There is a whole Users forum available for discussing how to implement CSLA.
http://groups.msn.com/CSLANET/messages.msnw

Petar Kozul has added some *amazing* extensions to the framework with his
ActiveObjects.
http://csla.kozul.info/
--
Joe Fallon

"NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
news:6d6dnSCkfaiQ6cncRVn-pg@.rogers.com...
> Is this the book I should read?
> http://www.amazon.com/exec/obidos/t...738524?v=glance
> I am going to buy if this is the one... Thanks a lot.
>
>
> "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
> message news:eFgtCKmoEHA.2140@.TK2MSFTNGP11.phx.gbl...
>> I am not sure I like either. One methodology that works well is the
> creation
>> of a persistance layer that controls marshalling the business objects
>> from
>> the database to your app. You have methods in the class that force the
>> callback, but the object-relation mapping engine (persistence layer part)
> is
>> actually aware of how to get the data back. This is a better OO design,
> and
>> you can find examples on open source sites like SourceForge (including
>> code).
>>
>> Rockford Lhotka has his own design of a data "persistance" type of engine
>> that looks promising. It is in both his VB.NET and C# objects books. You
> can
>> download the code and adopt it for your site.
>>
>> Finally, ObjectSpaces will be out in a future Visual Studio. It allows
>> mapping via an XML Schema. Unfortunately, it has been dumped from Whidbey
>> timeframe, but you can still get the March preview and play around with
> the
>> idea. If you can get a similar method, you will be ready when
>> objectspaces
>> are finally available.
>>
>> --
>> Gregory A. Beamer
>> MVP; MCP: +I, SE, SD, DBA
>>
>> *************************************************
>> Think outside the box!
>> *************************************************
>> "NOSPAM" <nospam@.xsagfgsagsafg.com> wrote in message
>> news:OsCdnXI8-P3i_cncRVn-tA@.rogers.com...
>> >I am designing a web application in asp.net C#, and I created classes
>> >(in
>> > .cs files) working with the .aspx pages. Now, for database part...
>> > wondering which way is better:
>>> > 1. put database connectivity in the Classes, each class has the
> load/save
>> > data method? Many of my classes are inherited from each other, and
>> > since
> I
>> > am using SQL 2000 which is a relational database makes the job little
> bit
>> > more complicated.
>>> > 2. put database connectivity in .aspx pages, then get/put the data
>> > from/into
>> > the classes when needed? This sounds easier, but is it a bad design?
>>> > Any suggestions are welcome.. thanks
>>>>>
>>

Object oriented

i am a computer science student and i want to research about object oriented. can anyone introduce refrences except MSDN?

Try the links below for Microsoft patterns and practice and other free resources. Hope this helps.

http://msdn.microsoft.com/practices/
http://forums.asp.net/thread/932927.aspx

Object Oriented

Hi
I Have 2 questions:
1) what is the difference betweenObject oriented design andObject oriented programming?
2) what is "Client/Server programming-3-tier architecture" ?(the red sentence)
Thank youHi, it is lengthy to give you the full definition of 3-tier architecture and distinct difference betwween the OOD and OOP. You can get the answer fromhttp://en.wikipedia.org/ or Google by typing "define:keyword" here.

Hope this helps...
Answer to 2
- http://www.corba.ch/e/3tier.html

thank you ...It was very helpful

Object Orientation Articles?

Can anyone suggest me some good articles on the object orientated programming on the internet? any links would do.
Thanks
Hi,
here you can find an introduction toOOP in VB.NET.
Grz, Kris.

object orientated dropdownlist

I'm trying to create a simple way to bind a dropdown, suppling a table name a field for a value and a field for the name i want bound. I have setup properties elsewhere in the class

1Public Class DataBinderClass2Protected WithEvents ddlAs System.Web.UI.WebControls.DropDownList3Private _tableAs String4 Private _fieldNameAs String5 Private _fieldValueAs String67 Public Sub DropDownBinder()8Dim objConnectionAs System.Data.OleDb.OleDbConnection9 objConnection =New OleDbConnection(ConfigurationManager.ConnectionStrings("DocumentConn").ConnectionString)10 objConnection.Open()11'So Now the Application has an open connection to the specific db12Dim strSQLAs String ="SELECT " & fieldValue &", " & fieldName() &" FROM " & table() &""13Dim objCmdAs New OleDbCommand(strSQL, objConnection)14'Create/Populate the DataReader15Dim objDRAs OleDbDataReader16 objDR = objCmd.ExecuteReader()17 ddl.DataTextField ="fld_username"18 ddl.DataValueField ="fld_id"19 ddl.DataSource = objDR20 ddl.DataBind()21 objDR.Close()22 objConnection.Close()23End Sub2425 Property table()As String' sets the table we are goin to get data from26Get27 Return _table28End Get29 Set(ByVal ValueAs String)30 _table = Value31End Set32 End Property3334 Property fieldName()As String' sets the field to retrieve from table35Get36 Return _fieldName37End Get38 Set(ByVal ValueAs String)39 _fieldName = Value40End Set41 End Property4243 Property fieldValue()As String' sets the field which will hold the value44Get45 Return _fieldValue46End Get47 Set(ByVal ValueAs String)48 _fieldValue = Value49End Set50 End Property51 End Class
Dim dbindAs New DataBinderClass dbind.table ="tbl_users" dbind.fieldName ="fld_username" dbind.fieldValue ="fld_id" dbind.DropDownBinder()

I have a dropdown declared like this

<form runat="server">
<asp:DropDownList ID="ddl" runat="server">
</asp:DropDownList></form>

However I get an object not initialised error at line 17 even though I have a

Protected WithEvents ddlAs System.Web.UI.WebControls.DropDownList at the top of my class
Anyone any ideas how to hook up the codebehind with my control? 

The second line of your code should be

Protected WithEvents ddlAs New System.Web.UI.WebControls.DropDownList
Thanks 


Pass the DDL reference into the sub

Public Sub DropDownBinder(ByRef yourDDL as DropDownList)

I'd also suggest passing in the object collection. Then you can reuse this easily. I've done similar and it's been a great timesaver.


Many thanks for the quick reply guys- super I'll give that a go. Curt the dropdownlist ID is a good idea, but as I was debugging the current error, I didn't want to confuse things too much!

It seems by your connection string call sytnax that you are using VS 2005. If so it is very much cleaner to use the object tags that accompany the dropdownlist when you drag it onto the page. With the FlyOut Tag you can quickly define a SQL statement to pull in your data and then choose the text and values shown in the dropdown.

But the old "alot of code way" :

1'Loads Interesction drop down box: LstTo23Sub GetXStreets(ByVal stcodeAs Long,ByRef oConnAs SqlConnection)45Dim sqlQueryAs String67Dim oreader2As SqlDataReader89Dim intersectionsAs ArrayList1011Dim sqlqueryIntClauseAs String1213Dim intersectionAs Long1415Dim sqlquerystClause1617Dim icAs Integer1819Dim cstreetAs String2021intersections =New ArrayList(100)2223sqlQuery ="SELECT Distinct Intersection# FROM Geo_St_Pairs WHERE (ArbStreetCode2 = " & stcode &") OR (ArbStreetCode1 = " & stcode &")"2425Dim ocmd2As New SqlCommand(sqlQuery, oConn)2627oreader2 = ocmd2.ExecuteReader()2829intersections.Clear()3031Do While oreader2.Read()3233intersections.Add(oreader2("Intersection#"))3435Loop36373839oreader2.Close()4041LstTo.Items.Clear()4243sqlQuery ="Select distinct StreetOrFeatureName from GEO_STREETS where arbStreetCode in ("4445sqlqueryIntClause ="Intersection# IN ("4647For Each intersectionIn intersections4849sqlqueryIntClause = sqlqueryIntClause & Str(intersection) &","5051Next5253sqlqueryIntClause = sqlqueryIntClause &"-1) "5455sqlQuery ="SELECT DISTINCT ArbStreetCode1 AS StreetCode FROM Geo_st_Pairs WHERE arbstreetcode1 <> " & Str(stcode)5657sqlQuery = sqlQuery &" AND " & sqlqueryIntClause5859sqlQuery = sqlQuery &" UNION SELECT DISTINCT ArbStreetCode2 AS streetcodex FROM Geo_st_pairs WHERE arbstreetcode2 <> " & Str(stcode)6061sqlQuery = sqlQuery &" AND " & sqlqueryIntClause6263' Label3.Text = sqlQuery6465ocmd2.CommandText = sqlQuery6667oreader2 = ocmd2.ExecuteReader()6869sqlquerystClause =" ArbStreetCode IN ("7071While oreader2.Read()7273sqlquerystClause = sqlquerystClause & oreader2("streetCode") &","7475End While7677sqlquerystClause = sqlquerystClause &"-1)"7879sqlQuery ="SELECT ArbStreetCode, StreetPrefixDirection, StreetOrFeatureName, StreetType " _8081&"FROM GEO_STREETS WHERE " & sqlquerystClause _8283&" ORDER BY StreetOrFeatureName"8485'oreader2 = ocmd2.ExecuteReader(CommandBehavior.CloseConnection)8687oreader2.Close()8889ocmd2.CommandText = sqlQuery9091oreader2 = ocmd2.ExecuteReader()9293ic = 09495Do While oreader2.Read()9697'Build up the street String!!!9899If Not IsDBNull(oreader2("StreetPrefixDirection"))Then100101cstreet = oreader2("StreetPrefixDirection") &" "102103Else104105cstreet =" "106107End If108109cstreet = cstreet & oreader2("StreetOrFeatureName")110111If Not IsDBNull(oreader2("StreetType"))Then112113cstreet = cstreet &" " & oreader2("StreetType")114115End If116117LstTo.Items.Add(cstreet)118119LstTo.Items(ic).Value = oreader2("arbStreetCode")120121ic = ic + 1122123Loop124125oreader2.Close()126127' Label3.Text = SqlQuery128129130131Dim stCode2As Long132133Dim stCode1As Long134135Try136137stCode1 = LstAlong.SelectedItem.Value138139stCode2 = LstTo.Items(0).Value'push the first item even though not selected140141Dim sb77As System.Text.StringBuilder =New System.Text.StringBuilder142143sb77.Append("<SCRIPT LANGUAGE=javascript>")144145sb77.Append("SelectBoth" & Chr(40) &"'supersegs'," & stCode1 & "," & stCode2 & Chr(41) & ";")146147sb77.Append("</SCRIPT>")148149'Inject the script onto the page--control where exactly the script enters the page150151'must be after the header--where javascript.js in included152153RegisterStartupScript("IntersectScript", sb77.ToString())154155Catch ex As Exception156157Response.Write("<script>alert(" & Chr(34) & "check spelling of street: use first letter and scroll!" & Chr(34) & ");</script>")158159160161End Try162163164165End Sub166

Lines 117-123 are the most imprtant--showing the loop and the dropdownlist adding the values via this loop based on the sql queries.

LstTo dropdown called like this in HTML code:
<asp:dropdownlist id="LstTo" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 144px" runat="server"Width="160px" Height="19px" AutoPostBack="True"></asp:dropdownlist><BR>

Rox


I'd also suggest passing in the object collection.

Can you explain what you mean by the "object collection"?


Sub mySub(byRef ddl as DropDownList, byRef myObjColl as Generic.ListOf(Object))

or if you want you could actually do the proper object but then you would need a sub for ever object collection type you have.

I take it a few steps further...here is what I use (note the sub is overridden to allow a selected value):

Public Overridable Sub FillDropDown(ByVal DropDownList As DropDownList, _
ByVal ObjectCollection As Object, _
ByVal ValueField As String, _
ByVal TextField As String, _
ByVal AddBlank As Boolean)

DropDownList.DataTextField = TextField
DropDownList.DataValueField = ValueField
DropDownList.DataSource = ObjectCollection
DropDownList.DataBind()
If (AddBlank) Then DropDownList.Items.Insert(0, "")
End Sub

Public Overridable Sub FillDropDown(ByVal DropDownList As DropDownList, _
ByVal ObjectCollection As Object, _
ByVal ValueField As String, _
ByVal TextField As String, _
ByVal AddBlank As Boolean, _
ByVal SelectedValue As String)

DropDownList.DataTextField = TextField
DropDownList.DataValueField = ValueField
DropDownList.DataSource = ObjectCollection
DropDownList.DataBind()
If (AddBlank) Then DropDownList.Items.Insert(0, "")
DropDownList.SelectedValue = SelectedValue
End Sub

Object Oriented Basics

I found some good articles, but nothing to pull everything together for me. To keep this simple, lets create a class to simply print "hello world" to a label on my page. My questions are:

1) I want to put the class code into an external file that I can reference and use on multiple pages. What do I need to do?

2) How can I have the class generate a string that is displayed on a label since I cant just say labelID.text=string?


thanks

You can do something like.
1public class DisplayString2{3public static void DispString(Label lbl,string str)4 {5 lbl.Text = str;6 }7}89// this is your call to that method from somewhere else.1011DisplayString.DispSpring(this.labelID,"Hello World");

Last time i tried that it worked.


narowgate:

I found some good articles, but nothing to pull everything together for me. To keep this simple, lets create a class to simply print "hello world" to a label on my page. My questions are:

1) I want to put the class code into an external file that I can reference and use on multiple pages. What do I need to do?

Hi,

That's called business object. Follow these steps:

1. Create .cs/.vb file where you should do something you want.

2. Compile the business object into a usable object. Then you will get *.dll in your project's bin\debug folder.

3. Add your new DLL via "Add Reference" when right click the Solution Explorer.

4. Finish. You can do your job.

narowgate:

2) How can I have the class generate a string that is displayed on a label since I cant just say labelID.text=string?


thanks

The reply above is right direction for you to follow. I hope that you should write your class with return a string or add get method. Then you can use get method to get string in the code-behind file.

Happy programming.

Object Oriented Analysis and Design (OOAD)

Hi,
If you have learn about OOAD, you should know about class diagram. In UML, class diagram is devided among
    Boundary Class; which responsible to User InterfaceEntity Class, which hold data about an object (for example Car.cs)Control Class, which responsible for coordination, interaction
I learn OOAD and try to build a simple web article managementapplication using C# (ASP.net). I have create a class diagram for thisapp, but confuse how to implement it on ASP.net. I have upload part ofmy UML in
http://www.topcupid.com/UML.zip
I had try to search on MSDN Library but only find an explanation aboutMCV (Model-Control-View). In MVC, Model is like an entity class (forexamle car class), View is the ASPX page, Control is ASPX code behind.
MVC is like boundary, entity, control class in UML, but things that make me confuse is :
1. Boundary is a class in UML, but in MVC, the view is the aspx page which is not a class
2. If I make code behind in ASPX page as a boundary class, then who is the control class?
Please help me

Thanks, any answer will be appreciated.
Yonscun

Here is what a member of the ASP.NET Teamtold me about MVC in ASP.NET:

First, let me point out that MVC has never been a pattern that fit well in ASP.NET. Actually, Martin Fowler introduced in "Patterns of enterprise application architecture" the Page Controller pattern that better reflects a typical ASP.NET application. There are some MVC frameworks for .NET, but they are somewhat convoluted and sacrifice most of the cool things of ASP.NET on the MVC altar.

However, if you are truly keen to use the MVC pattern with ASP.NET, the following article will help you:
Applying Robustness Analysis on the Model-View-Controller (MVC) Architecture in ASP.NET Framework, using UML

If you want to use theconcept of MVC, without the true pattern, you can do the following (which many developers do): consider your .aspx page to be theview, consider its code-behind to be thecontroller, and allow a business object (or even just a DataSet) be themodel. This wouldnot be the MVC pattern, but it will give you a way of separating concerns, and a way that fits well with ASP.NET.

By the way, an .aspx pageis a class, it is simply authored in a different way (it uses declarative programming rather than procedural programming).


I was preparing for the IBM OOAD exam in 2001 when I got the email to start C# training from Microsoft. And last year we used a lot of MVC reference materials from MSDN and Microsoft is expanding the patterns but to enable developers in a web application context not the complete UML. Try the links below for a lot of UML resources including complete
factory pattern with class diagram and C# code all from OO experts. Hope this helps.


http://openmymind.net/NetDesignArticles.aspx

http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/CustEntCls.asp


Hi thank for replying,
Actually Model-View-Control is not my primary goal.
I just try to figure out how to implement boundary classes, entityclasses, and control classes. After googling and searching in MSDNlibrary, I found about this MVC concept.
But any body know how to implement this boundary, control, and entity class in ASP.net?

You are a student so try these links everything you need to study is covered. Hope this helps.


http://consulting.dthomas.co.uk/software_architecture_consulting/articles_resources.htm

http://msdn.microsoft.com/architecture/community/webcasts/default.aspx


Hi, thanks to all (a really helpful link)

Eh, I confuse about "broker class" that said can separate business (entity) class with database connection.

If "car" class has a broker class named "CarBroker" class then please can anyone tell me how this class work?


Edit

The Broker is middletier like message queues or Microsoft Biztalk, the later is very expensive but it can talk to all systems through XML. Again you are a student so I have got you study links but try and get UML distilled by Martin Fowler so you can get the short version of all you need. Asp.net stripes all these to bare bone because HTTP is stateless, human interaction application needs are different from business oriented UML. There is a problem with the second link the *** replaced (d1ck ) which is Richard in short but not accepted word on the forums. Hope this helps.

http://www.jot.fm/issues/issue_2004_09/article1
http://www.csci.csusb.edu/***/samples/uml.html


Hi thanks everyone, your links really help me a lot

I read some of tutorial link abouve and read again my OOAD books (simmon bennet - MC Graw Hill), now It's a little clear how this broker work.
But I still confuse in better way to store my newly created class to MSSQL database.
Lets say an administrator want to post a new article to his website so all visitor can read it.
The admin surely will create a new instance of class article and store it on database.
It's pretty simple to create an instance of article class. But when an instance of article class is created, it must to immediately stored to database.
But Who will responsible to store article to database? The article class itselft or it's database broker class?
If article class is responsible to implement saveToDatabase() function then separation between article (entity class) and article broker class (database broker class) will be broken.
If broker class is responsible to implement saveToDatabase() function then how an instance of article class send itselft to database broker? or maybe article class just need send all its attibute?
Please help me,

Try this it covers Objects and Data including O/R(Object relational ) Mapping but I think you should post on the Architecture forum to get the right answer. Hope this helps.
http://martinfowler.com/eaaCatalog/

object oriented design

I am fairly new to oo design and I am looking at developing an object
oriented asp.net application which will be built on top of a relational
database. I have read quite a bit of the theory but find it hard to put it
into practice. In particular I am in terms of interacting with the
database. It seems to me classes map quite closely to database tables and I
end up with a bunch of methods in each class which simply call stored
procedures to do data access eg. AddOrder method in an Order class. In that
case oo design just seems like a wrapper on top of the database. I don't se
e
what is gained over just using procedural techniques to group related
functions together into modules. I am sure I am missing something.
Any pointers to get on the right track? Specific advice or samples of a
good design would be more appreciated that a pointer to a general book
(although if someone knows of something dealing with this specific problem
that would be great.)
--
ScottScott,
I don't think you are missing anything. For simple systems your database
does map very closely to your objects and you do end up with a lot of code.
Some solutions to this are to use (a) a code generation tool (google search
CodeSmith) and (b) a professional O/R mapper (google search WilsonOR)
I love codesmith :)
Anyways, back to the topic..the benefit you gain with OO is more noticable
as your system grows complex. You'll see that your relational data doesn't
map so well to your object world (google search Object-Relational impedence
mismatch). A classic example is inheritance which brings forth tremendous
benefits that you can't get from a more procedural technique.
A solution might be to use a Data Mapper Design pattern
(http://www.martinfowler.com/eaaCatalog/dataMapper.html). This would leave
your classes as more pure domain objects and move the mundane and repetivie
mapping to its own layer/class. Great for even more flexibility.
If you aren't taking advantage of encapsulation, abstraction, inheritance
and polymorphism in your classes, ask yourself if you could..or think ahead
and see if they might be necessary with future requirements. Chances ar the
flexibility you've given yourself by this approach will pay off for itself
...even if it seems a little straightforward now..
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A0BD364-9A7A-44E1-82DC-BFD4260F14D5@.microsoft.com...
> I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am in terms of interacting with
the
> database. It seems to me classes map quite closely to database tables and
I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In
that
> case oo design just seems like a wrapper on top of the database. I don't
see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)
> --
> Scott
Although it is quite hard to learn initially, Enterprise Core Objects from
Borland is an excellent tool.
You design the model in UML, it generates the DB for you, and you work only
with objects (never the db).
My website howtodothings.com was written with it, and I don't have a single
SQL statement in the whole project.
Pete
====
Read or write articles on just about anything
http://www.HowToDoThings.com
My blog
http://blogs.slcdug.org/petermorris/
Hi Scott,
Well, it sounds like you're on the right track, believe it or not. You have
to look at the evloution of programming to understand it more clearly.
In the beginning (almost), code was simply instructions that were executed
in the order in which they appeared in the source. It was soon discovered,
however, that certain blocks of code were commonly executed again and again.
This was initially solved with GoTo statements, which instructed the
compiler to go to a certain location in the code, execute the instructions
there, and return to the point it left from. And this lasted a while.
As the size and complexity of programs grew, GoTo statements made for some
serious spaghetti code, which became hard to maintain and modify. The
concept of more ordered source code, using functions and sub-procedures was
introduced to make code easier to manage.
Of course, this convenience only lasted awhile, as programs grew more in
complexity, and multi-tasking operating systems were introduced. Believe it
or not, Windows 3.1 was written in C, not C++. It used a heck of a lot of
loops and nested loops to do multi-tasking, messaging, and so on. You can
imagine the difficulty in maintaining such a huge program, which was made up
essentially of a single set of instructions that was immense in size.
At this point, due to the complexity of programs, new data types were
introduced called "structures." A structure is simply a combination of
multiple data and types of data into a single unit. It made code
organization easier, and a structure could hold both State and Process. In
other words, a member of a structure could be a piece of data, such as an
integer, or it could be a process, such as a function. Are we starting to
sound a little familiar at this point? We should be.
Enter Object-Oriented programming. Structures evolved into
objects/types/classes. OOP enhanced the structure concept, and added a few
of its own:
Inheritance: Inheritance performs much the same function as functions and
sub-procedures in terms of what its purpose is. By defining a base class,
and inheriting it, one could build multiple classes that shared some of the
same state and process, but with additional characteristics as well. In
addition, the developer doesn't have to re-write the same code to create a
new class. The code in a class is relatively lean, as much of the code
resides in the base class. This makes code maintenance and debugging much
easier.
Encapsulation: OOP introduced the idea of hiding members of a class in a
variety of ways. By doing so, the possible errors that could occur were
minimized. Only the members necessary to access fro outside the class are
exposed. There is no way that something outside the class can modify
something that it should not. This also enhances code maintenance and
debugging, by reducing the number of variables that can affect performance
of the app.
Polymorphism: Plolymorphism was actually introduced in earlier procedural
languages, with the concept of overloaded functions, by defining a function
as accepting different data types, and behaving differently when using them.
Classes extend the concept with overrides and other similar mechanisms that
allow a class to behave differently in different circumstances.
Abstraction: A little harder to define. Abstraction is an outgrowth of
encapsulation, in a sense. By hiding the details of how an object performs
its tasks, other objects can treat the class as if it were a "machine" that
performs some task, rather than a set of instructions. This also simplifies
code creation and maintenance.
All of this has come about as a result of computer and software evolution.
Just as Assembler language was developed to reduce the amount of time
necessary to write an application in machine code, each evolutionary stage
of programming technology is designed to reduce the amount of time and
resources necessary to write, debug, and maintain software.
The better your object model, the easier and quicker you can write
applications with it. If you're wise, you will create re-usable classes that
will continually reduce the amount of time and effort spent in future
development.
So, in conclusion, what is gained by OOP is the same thing that is gained
with "just using procedural techniques to group related functions together
into modules." It is simply the next stage in the evloution of programming.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A0BD364-9A7A-44E1-82DC-BFD4260F14D5@.microsoft.com...
>I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am in terms of interacting with
> the
> database. It seems to me classes map quite closely to database tables and
> I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In
> that
> case oo design just seems like a wrapper on top of the database. I don't
> see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)
> --
> Scott
Hi Scott,
On top of what's been said, the fact that your db classes are just
wrappers for the db allows for a very academic N-Tiers architecture.
Down the road, N-Tiers is (are?) safer and less error-prone.
PS : and if you read Kevin's answer, you'll see that oo teaches you to
be both synthetic and crystal-clear. Nice piece, Kevin.
HTH,
Michel
"examnotes" <scottrm@.newsgroup.nospam> wrote in message news:<4A0BD364-9A7A-
44E1-82DC-BFD4260F14D5@.microsoft.com>...
> I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am in terms of interacting with th
e
> database. It seems to me classes map quite closely to database tables and
I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In tha
t
> case oo design just seems like a wrapper on top of the database. I don't
see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)

object oriented design

I am fairly new to oo design and I am looking at developing an object
oriented asp.net application which will be built on top of a relational
database. I have read quite a bit of the theory but find it hard to put it
into practice. In particular I am confused in terms of interacting with the
database. It seems to me classes map quite closely to database tables and I
end up with a bunch of methods in each class which simply call stored
procedures to do data access eg. AddOrder method in an Order class. In that
case oo design just seems like a wrapper on top of the database. I don't see
what is gained over just using procedural techniques to group related
functions together into modules. I am sure I am missing something.
Any pointers to get on the right track? Specific advice or samples of a
good design would be more appreciated that a pointer to a general book
(although if someone knows of something dealing with this specific problem
that would be great.)
--
ScottScott,
I don't think you are missing anything. For simple systems your database
does map very closely to your objects and you do end up with a lot of code.
Some solutions to this are to use (a) a code generation tool (google search
CodeSmith) and (b) a professional O/R mapper (google search WilsonOR)

I love codesmith :)

Anyways, back to the topic..the benefit you gain with OO is more noticable
as your system grows complex. You'll see that your relational data doesn't
map so well to your object world (google search Object-Relational impedence
mismatch). A classic example is inheritance which brings forth tremendous
benefits that you can't get from a more procedural technique.

A solution might be to use a Data Mapper Design pattern
(http://www.martinfowler.com/eaaCatalog/dataMapper.html). This would leave
your classes as more pure domain objects and move the mundane and repetivie
mapping to its own layer/class. Great for even more flexibility.

If you aren't taking advantage of encapsulation, abstraction, inheritance
and polymorphism in your classes, ask yourself if you could..or think ahead
and see if they might be necessary with future requirements. Chances ar the
flexibility you've given yourself by this approach will pay off for itself
...even if it seems a little straightforward now..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A0BD364-9A7A-44E1-82DC-BFD4260F14D5@.microsoft.com...
> I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am confused in terms of interacting with
the
> database. It seems to me classes map quite closely to database tables and
I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In
that
> case oo design just seems like a wrapper on top of the database. I don't
see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)
> --
> Scott
Although it is quite hard to learn initially, Enterprise Core Objects from
Borland is an excellent tool.

You design the model in UML, it generates the DB for you, and you work only
with objects (never the db).

My website howtodothings.com was written with it, and I don't have a single
SQL statement in the whole project.

--
Pete
====
Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
Hi Scott,

Well, it sounds like you're on the right track, believe it or not. You have
to look at the evloution of programming to understand it more clearly.

In the beginning (almost), code was simply instructions that were executed
in the order in which they appeared in the source. It was soon discovered,
however, that certain blocks of code were commonly executed again and again.
This was initially solved with GoTo statements, which instructed the
compiler to go to a certain location in the code, execute the instructions
there, and return to the point it left from. And this lasted a while.

As the size and complexity of programs grew, GoTo statements made for some
serious spaghetti code, which became hard to maintain and modify. The
concept of more ordered source code, using functions and sub-procedures was
introduced to make code easier to manage.

Of course, this convenience only lasted awhile, as programs grew more in
complexity, and multi-tasking operating systems were introduced. Believe it
or not, Windows 3.1 was written in C, not C++. It used a heck of a lot of
loops and nested loops to do multi-tasking, messaging, and so on. You can
imagine the difficulty in maintaining such a huge program, which was made up
essentially of a single set of instructions that was immense in size.

At this point, due to the complexity of programs, new data types were
introduced called "structures." A structure is simply a combination of
multiple data and types of data into a single unit. It made code
organization easier, and a structure could hold both State and Process. In
other words, a member of a structure could be a piece of data, such as an
integer, or it could be a process, such as a function. Are we starting to
sound a little familiar at this point? We should be.

Enter Object-Oriented programming. Structures evolved into
objects/types/classes. OOP enhanced the structure concept, and added a few
of its own:

Inheritance: Inheritance performs much the same function as functions and
sub-procedures in terms of what its purpose is. By defining a base class,
and inheriting it, one could build multiple classes that shared some of the
same state and process, but with additional characteristics as well. In
addition, the developer doesn't have to re-write the same code to create a
new class. The code in a class is relatively lean, as much of the code
resides in the base class. This makes code maintenance and debugging much
easier.

Encapsulation: OOP introduced the idea of hiding members of a class in a
variety of ways. By doing so, the possible errors that could occur were
minimized. Only the members necessary to access fro outside the class are
exposed. There is no way that something outside the class can modify
something that it should not. This also enhances code maintenance and
debugging, by reducing the number of variables that can affect performance
of the app.

Polymorphism: Plolymorphism was actually introduced in earlier procedural
languages, with the concept of overloaded functions, by defining a function
as accepting different data types, and behaving differently when using them.
Classes extend the concept with overrides and other similar mechanisms that
allow a class to behave differently in different circumstances.

Abstraction: A little harder to define. Abstraction is an outgrowth of
encapsulation, in a sense. By hiding the details of how an object performs
its tasks, other objects can treat the class as if it were a "machine" that
performs some task, rather than a set of instructions. This also simplifies
code creation and maintenance.

All of this has come about as a result of computer and software evolution.
Just as Assembler language was developed to reduce the amount of time
necessary to write an application in machine code, each evolutionary stage
of programming technology is designed to reduce the amount of time and
resources necessary to write, debug, and maintain software.

The better your object model, the easier and quicker you can write
applications with it. If you're wise, you will create re-usable classes that
will continually reduce the amount of time and effort spent in future
development.

So, in conclusion, what is gained by OOP is the same thing that is gained
with "just using procedural techniques to group related functions together
into modules." It is simply the next stage in the evloution of programming.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A0BD364-9A7A-44E1-82DC-BFD4260F14D5@.microsoft.com...
>I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am confused in terms of interacting with
> the
> database. It seems to me classes map quite closely to database tables and
> I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In
> that
> case oo design just seems like a wrapper on top of the database. I don't
> see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)
> --
> Scott
Hi Scott,

On top of what's been said, the fact that your db classes are just
wrappers for the db allows for a very academic N-Tiers architecture.
Down the road, N-Tiers is (are?) safer and less error-prone.

PS : and if you read Kevin's answer, you'll see that oo teaches you to
be both synthetic and crystal-clear. Nice piece, Kevin.

HTH,

Michel

"=?Utf-8?B?c2NvdHRybQ==?=" <scottrm@.newsgroup.nospam> wrote in message news:<4A0BD364-9A7A-44E1-82DC-BFD4260F14D5@.microsoft.com>...
> I am fairly new to oo design and I am looking at developing an object
> oriented asp.net application which will be built on top of a relational
> database. I have read quite a bit of the theory but find it hard to put it
> into practice. In particular I am confused in terms of interacting with the
> database. It seems to me classes map quite closely to database tables and I
> end up with a bunch of methods in each class which simply call stored
> procedures to do data access eg. AddOrder method in an Order class. In that
> case oo design just seems like a wrapper on top of the database. I don't see
> what is gained over just using procedural techniques to group related
> functions together into modules. I am sure I am missing something.
> Any pointers to get on the right track? Specific advice or samples of a
> good design would be more appreciated that a pointer to a general book
> (although if someone knows of something dealing with this specific problem
> that would be great.)

object oriented design books

Any recommendations for a good book/article/sample on object oriented design
particularly with regards to building an asp.net/sql server application. I
don't mean a book explaining concepts like inheritance etc. but one that
actually tells you how to design a system. I have read a few and although
they sound ok in theory they tend to be rather impractial when it actually
comes to implementing anything.
--
ScottThere are an infinite number of potential applications, and therefore an
infinite number of ways to design them.
This book is great for helping you figure out how to design the object model
behind large and complex applications:
Expert One-on-One Visual Basic .NET Business Objects (by Rockford Lhotka)
http://www.amazon.com/exec/obidos/A...3&link_code=as1
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A9F0DBD-7A30-4EC8-9D79-E9B6F00C31EE@.microsoft.com...
> Any recommendations for a good book/article/sample on object oriented
> design
> particularly with regards to building an asp.net/sql server application. I
> don't mean a book explaining concepts like inheritance etc. but one that
> actually tells you how to design a system. I have read a few and although
> they sound ok in theory they tend to be rather impractial when it actually
> comes to implementing anything.
> --
> Scott

object oriented design books

Any recommendations for a good book/article/sample on object oriented design
particularly with regards to building an asp.net/sql server application. I
don't mean a book explaining concepts like inheritance etc. but one that
actually tells you how to design a system. I have read a few and although
they sound ok in theory they tend to be rather impractial when it actually
comes to implementing anything.
--
ScottThere are an infinite number of potential applications, and therefore an
infinite number of ways to design them.
This book is great for helping you figure out how to design the object model
behind large and complex applications:

Expert One-on-One Visual Basic .NET Business Objects (by Rockford Lhotka)
http://www.amazon.com/exec/obidos/A...3&link_code=as1

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"scottrm" <scottrm@.newsgroup.nospam> wrote in message
news:4A9F0DBD-7A30-4EC8-9D79-E9B6F00C31EE@.microsoft.com...
> Any recommendations for a good book/article/sample on object oriented
> design
> particularly with regards to building an asp.net/sql server application. I
> don't mean a book explaining concepts like inheritance etc. but one that
> actually tells you how to design a system. I have read a few and although
> they sound ok in theory they tend to be rather impractial when it actually
> comes to implementing anything.
> --
> Scott

object oriented question

Hello all,

I have an object in business layer called
JPPage
Which has the properties:
id
title
content
parent
level

what I want to know is. I have a crumb trail on my front end which
only requires the properties id and title. So do I use a collection of
JPPage objects (even though the JPPage object has more properties that
I need for my crumb trail) or do I create a crumb trail object with
properties id and title? If I do this then in essense I have duplicate
code.

Or do I create an object, for example, called JPSimplePage with the
properties id and title and then create an object JPPage which
inherits JPSimplePage and has the additional properties of content,
parent and level?

Thanks in advance, just want to get my OO methology correct.

thanks
RussRussell,
First off, I don't see anything overly wrong with having a collection of
JPPage objects which only have a couple of their properties set. The only
real problem I see is that people might try to access other properties -
since it's fairly reasonable to expect the entire set of properties to be
properly set.

I think your inheritance idea is the way to go. This way there's no
confusion about what data is available when.

KArl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Russell" <russell8mccloy@.hotmail.com> wrote in message
news:15098e16.0411250431.6fcaa40d@.posting.google.c om...
> Hello all,
> I have an object in business layer called
> JPPage
> Which has the properties:
> id
> title
> content
> parent
> level
> what I want to know is. I have a crumb trail on my front end which
> only requires the properties id and title. So do I use a collection of
> JPPage objects (even though the JPPage object has more properties that
> I need for my crumb trail) or do I create a crumb trail object with
> properties id and title? If I do this then in essense I have duplicate
> code.
> Or do I create an object, for example, called JPSimplePage with the
> properties id and title and then create an object JPPage which
> inherits JPSimplePage and has the additional properties of content,
> parent and level?
> Thanks in advance, just want to get my OO methology correct.
> thanks
> Russ

cheers Karl.. I thought you might say that. Im loving OO. no more
spagetti code!!

RuSs

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Russell if you have duplicate code then you may need a further level in your
hierarchy

How about:

BaseObject
id

CrumbObject : BaseObject
title

JPPage : CrumObject
content
parent
level

MattC

"Russell" <russell8mccloy@.hotmail.com> wrote in message
news:15098e16.0411250431.6fcaa40d@.posting.google.c om...
> Hello all,
> I have an object in business layer called
> JPPage
> Which has the properties:
> id
> title
> content
> parent
> level
> what I want to know is. I have a crumb trail on my front end which
> only requires the properties id and title. So do I use a collection of
> JPPage objects (even though the JPPage object has more properties that
> I need for my crumb trail) or do I create a crumb trail object with
> properties id and title? If I do this then in essense I have duplicate
> code.
> Or do I create an object, for example, called JPSimplePage with the
> properties id and title and then create an object JPPage which
> inherits JPSimplePage and has the additional properties of content,
> parent and level?
> Thanks in advance, just want to get my OO methology correct.
> thanks
> Russ

Object Oriented Programming

Hi everybody,
this is nanda kumar,
i want to knowdrawback of objects in oops concepts.
regards,
Nanda kumar. R

Think of OOP as providing services. A method can provide services to many classes and other methods that request it. The main concept behind OOP is reduction of code through code reusability. OOP improves your code by making it more robust. I can't think of anything negitive that OOP presents over traditional procedural programming.


The only drawback I can think of is that it's more difficult to learn (and visualize) than the traditional sequential/structured programming model. Once you become familiar with the concept, it will save you both time and coding.

object oriented question

Hello all,
I have an object in business layer called
JPPage
Which has the properties:
id
title
content
parent
level
what I want to know is. I have a crumb trail on my front end which
only requires the properties id and title. So do I use a collection of
JPPage objects (even though the JPPage object has more properties that
I need for my crumb trail) or do I create a crumb trail object with
properties id and title? If I do this then in essense I have duplicate
code.
Or do I create an object, for example, called JPSimplePage with the
properties id and title and then create an object JPPage which
inherits JPSimplePage and has the additional properties of content,
parent and level?
Thanks in advance, just want to get my OO methology correct.
thanks
RussRussell,
First off, I don't see anything overly wrong with having a collection of
JPPage objects which only have a couple of their properties set. The only
real problem I see is that people might try to access other properties -
since it's fairly reasonable to expect the entire set of properties to be
properly set.
I think your inheritance idea is the way to go. This way there's no
confusion about what data is available when.
KArl
MY ASP.Net tutorials
http://www.openmymind.net/
"Russell" <russell8mccloy@.hotmail.com> wrote in message
news:15098e16.0411250431.6fcaa40d@.posting.google.com...
> Hello all,
> I have an object in business layer called
> JPPage
> Which has the properties:
> id
> title
> content
> parent
> level
> what I want to know is. I have a crumb trail on my front end which
> only requires the properties id and title. So do I use a collection of
> JPPage objects (even though the JPPage object has more properties that
> I need for my crumb trail) or do I create a crumb trail object with
> properties id and title? If I do this then in essense I have duplicate
> code.
> Or do I create an object, for example, called JPSimplePage with the
> properties id and title and then create an object JPPage which
> inherits JPSimplePage and has the additional properties of content,
> parent and level?
> Thanks in advance, just want to get my OO methology correct.
> thanks
> Russ

cheers Karl.. I thought you might say that. Im loving OO. no more
spagetti code!!
RuSs
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Russell if you have duplicate code then you may need a further level in your
hierarchy
How about :
BaseObject
id
CrumbObject : BaseObject
title
JPPage : CrumObject
content
parent
level
MattC
"Russell" <russell8mccloy@.hotmail.com> wrote in message
news:15098e16.0411250431.6fcaa40d@.posting.google.com...
> Hello all,
> I have an object in business layer called
> JPPage
> Which has the properties:
> id
> title
> content
> parent
> level
> what I want to know is. I have a crumb trail on my front end which
> only requires the properties id and title. So do I use a collection of
> JPPage objects (even though the JPPage object has more properties that
> I need for my crumb trail) or do I create a crumb trail object with
> properties id and title? If I do this then in essense I have duplicate
> code.
> Or do I create an object, for example, called JPSimplePage with the
> properties id and title and then create an object JPPage which
> inherits JPSimplePage and has the additional properties of content,
> parent and level?
> Thanks in advance, just want to get my OO methology correct.
> thanks
> Russ

Object passed ByRef or ByVal

Is MyClassObject passed to the sub ParseMyObject ByRef or ByVal?
If it is passed ByVal, which I thought was the default, would this be heavy on memory if the MyClass Class contained a lot of variables? And if it is ByVal, would it be more effecient for me to pass it ByRef cause it will make a pointer and not copy the whole object?
Thank you
Ryan


Dim MyClassObject as New MyClass()
ParseMyObject(MyClassObject)

Public Sub ParseMyObject(MyClassObject as MyClass)
asfsfsad
End Sub

Hi Ryan,
There is no point in passing Reference types (classes) ByRef. Any Reference type is, basically, smart pointer with type information and reference to actual class data. When you passing class ByVal, this structure being copied, but it reference the same location of actual data on heap. Bottom line: in most cases pass classes ByVal.
Is there a known list that defines "Reference" Type object?
I've read in one of the .net books that these operate differently? it didn't work for me though...


dim a as string = "123"
dim b as string = a
a = "456"
response.write(b) 'this would write 456 to the screen

dim x as integer = 4
dim y as integer = x
x = 6
response.write(y) 'this would write 4 to the screen?

So i'm guessing strings are always reference types and integers are not?
Help is appreciated
Thankyou
ryan
Hi Ryan,
It is bit confusing. String is reference type, but it behaves much like value type. It is immutable (new copy created on each change). Integers and other basic types are value types. SeeStrings UNDOCUMENTED for great in depth look at .NET strings.

Object Performance

I have an object A that inherits from object B which inherits from object C. It in total then has about 25 members/attributes. I am wondering that by instantiating this object A does it impact on performance.Only the normal performance you should get by instantiating 3 different objects.

Thank you.

What factors determine an objects performance?


That's not necessarily true. I wouldn't think of it as instantiating 3 different objects. Instead, look at it as aMatryoshka doll (aka Russian nesting doll). The only performance (or other) degradation you'll see will be what the parent objects had. For instance, instantiating A, B, and C as separate objects (assuming they weren't inherited from one another) would be worse than instantiating C alone, with inheritance.

I don't know if I explained that very well, but in the end, there won't be a whole lot of difference. I just wanted to clear up how you should consider inheritance and its affect to the system. Additionally, you may notice a performance hit depending on how classes are defined and/or objects are accessed. For instance, I believe explicit interface definitions have a minor performance hit (not that this affects your scenario). Also, if you have to do any casting, that will definitely be a performance hit, so try to avoid that when possible.


flanakin:

That's not necessarily true. I wouldn't think of it as instantiating 3 different objects. Instead, look at it as aMatryoshka doll (aka Russian nesting doll). The only performance (or other) degradation you'll see will be what the parent objects had. For instance, instantiating A, B, and C as separate objects (assuming they weren't inherited from one another) would be worse than instantiating C alone, with inheritance.

I don't know if I explained that very well, but in the end, there won't be a whole lot of difference. I just wanted to clear up how you should consider inheritance and its affect to the system. Additionally, you may notice a performance hit depending on how classes are defined and/or objects are accessed. For instance, I believe explicit interface definitions have a minor performance hit (not that this affects your scenario). Also, if you have to do any casting, that will definitely be a performance hit, so try to avoid that when possible.

Thanks for your help Michael.

I dont quiet understand what you mean by "explicit interface definitions", could you explain?

The way i have used Object A is:

ObjectA o = new ObjectA();

o.ObjectAAttribute = value1;

o.ObjectAAnotherAttribute = value5;

o.ObjectBAttribute = value2;

o.ObjectCAttribute = (int)value3;


Anexplicit inheritance implementation is done within the class definition. Some people make it a point to always do this, but I've heard it has a slight performance hit. Note that I haven't verified this, tho, so it may not be true. Based on your scenario, this isn't even a problem because you're not dealing with interfaces.

From what you've described, the only performance issue you really need to worry about is the overhead that each parent object provides. If they aren'ttrue parent objects (when looking at it from an OO purist standpoint), they should'nt be parent objects. What I mean by this is, if A is a cat, B is a dog, and C is a fish, don't inherit helper properties and methods they all may coincidentally use. Pull those out into separate classes. I don't know if this applies to you, tho, so you're probably fine.


Thanks for your help. The objects I believe are true parent objects.

Object A: Persons Details

Object B: Persons Answers to questions

Object C: Persons Status details

No helper properties or methods are being inherited only attributes.

Thanks.

Object persistence

Hello,
I have a page (page1.aspx) that builds some complex .NET objects.
I successfully pass these objects to another different window (page2.aspx).
How can I persist these objects on a POST back of the same window
(page2.aspx)?
Thank you
MarcelMarcel Balcarek wrote:

> Hello,
> I have a page (page1.aspx) that builds some complex .NET objects.
> I successfully pass these objects to another different window (page2.aspx)
.
> How can I persist these objects on a POST back of the same window
> (page2.aspx)?
> Thank you
> Marcel
>
You can use the session object to store them, or you even better you can
store them in view state of the page itself, so that you dont have to
worry about server resources and stuff ..
Hi Marcel,
Static variables, Session variable, Application variable, Viewstate.
Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
jamesche@.online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--
>From: "Marcel Balcarek" <marcel_balcarek@.REM-OVEMEtoxicall.com>
>Subject: Object persistence
>Date: Thu, 15 Apr 2004 10:34:00 -0600
>Lines: 11
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <u7IlFfwIEHA.3060@.TK2MSFTNGP11.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: c-67-165-238-210.client.comcast.net 67.165.238.210
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:225884
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Hello,
>I have a page (page1.aspx) that builds some complex .NET objects.
>I successfully pass these objects to another different window (page2.aspx).
>How can I persist these objects on a POST back of the same window
>(page2.aspx)?
>Thank you
>Marcel
>
>
Hi Jim,
Thanks for the info. Due to the size of the objects I am persisting, and
the low bandwidth some of my customers enjoy, I have decided to serialize
my objects and use the binaryFormatter, and then store them as byte arrays
in a general DB table that has an image column.
I discounted viewstate because of its sheer size (network traffic) - I
tested viewstate with a tiny object (2 Int32s) and it added about 3 lines to
my HTML output.
I discounted session variables because that solution is not scalable for
large amounts of data.
Other than initial setup effort, my solution should be ok no?
Marcel
"Jim Cheshire [MSFT]" <jamesche@.online.microsoft.com> wrote in message
news:JpIBY78IEHA.2644@.cpmsftngxa06.phx.gbl...
> Hi Marcel,
> Static variables, Session variable, Application variable, Viewstate.
> Jim Cheshire, MCSE, MCSD [MSFT]
> ASP.NET
> Developer Support
> jamesche@.online.microsoft.com
> This post is provided "AS-IS" with no warranties and confers no rights.
>
> --
microsoft.public.dotnet.framework.aspnet:225884
(page2.aspx).
>
Hi Marcel,
That should work fine. It's worth mentioning that if you are not making
heavy use of Session state otherwise, you can use SqlServer Session state
and make this process automatic and much easier to implement. Bear in mind
that if you ARE making heavy use of Session state elsewhere in your app,
you will see performance degradation if you move from InProc to SqlServer
mode for Session state.
Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
jamesche@.online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--
>From: "Marcel" <marcelbalcarek@.REMOVEMEmsn.com>
>References: <u7IlFfwIEHA.3060@.TK2MSFTNGP11.phx.gbl>
<JpIBY78IEHA.2644@.cpmsftngxa06.phx.gbl>
>Subject: Re: Object persistence
>Date: Sat, 17 Apr 2004 14:43:23 -0600
>Lines: 66
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <OcJ2OyLJEHA.1388@.TK2MSFTNGP09.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 168-103-77-32.dnvr.qwest.net 168.103.77.32
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:227215
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Hi Jim,
>Thanks for the info. Due to the size of the objects I am persisting, and
>the low bandwidth some of my customers enjoy, I have decided to serialize
>my objects and use the binaryFormatter, and then store them as byte arrays
>in a general DB table that has an image column.
>I discounted viewstate because of its sheer size (network traffic) - I
>tested viewstate with a tiny object (2 Int32s) and it added about 3 lines
to
>my HTML output.
>I discounted session variables because that solution is not scalable for
>large amounts of data.
>Other than initial setup effort, my solution should be ok no?
>Marcel
>
>"Jim Cheshire [MSFT]" <jamesche@.online.microsoft.com> wrote in message
>news:JpIBY78IEHA.2644@.cpmsftngxa06.phx.gbl...
>microsoft.public.dotnet.framework.aspnet:225884
>(page2.aspx).
>
>