Hi Mark,
Welcome. :-)
I've also seen your another thread in this group about the global.asax's
component desiging question, I've posted there.
As for the questions about the new ASP.NET 2.0 data accessing model, here
are some of my understanding:
1. Yes, the ASP.NET 2.0 no longer used the original component based Data
Accessing model, it use the DataSource control to replace the (
DataSet+DataAdapter+ Connection ), thus, we can avoid many autogenerated
code in code behind, but use the statically defined control template in
aspx page.... Using the configuration wizard and smartTag in VS2005 for
generating or configuration datasource control are quite easy.... The
DataSource controls can let us define some selecting or filtering
expression and parameters which help customizing the select result......
these parameters can be bound to many sources (querystring, form, Control,
......)
2. For the using TypedDataSet and typed DataRow object, there still exists
such model, and this is even enhanced by the new TypedDataSet +
TableAdapter model. Through the VS 2005 IDE, we can easily create a
TypedDataSet from DataBase and together with a TableAdapter which
encapsulate all the code wo used to configure through DataAdaper. (You can
see my reply in your another thread on this...). Thus, we can still
directly use TableAdapter to get a TypedDataSet or a TypedDataTable and use
that to bind the Databound controls (GridView, DataList,
DetailsView......).
SqlDataSource control is mainly used for encapsulating the (unTypedDataset
+ DataAdapter ) data accessing model, in the asp.net 2.0, we can also find
the ObjectDataSource control, this control is used for associate the
ASP.NET databound controls with our buisness or dataaccess components, and
one typical scenario for using ObjectDataSource is just configure the
TableAdapter (we mentioned above) in the ObjectDatasource and bind the
ObjectDataSource control to the databound controls ......., if you feel the
autogenerated methods are not sufficient, we can add our own methods into
the generated class or event define our own dataaccessing Class, and
configure it in ObjectDataSource....
Also, when adding a Datasource control onto an ASP.NET 2.0 page, it's not
necessary to bind them to a databound control, we can also programmatically
use them to get a Data record set by calling their Select method. Some
pre/post processing events like Seelcting/Selected, updating/updated......
also help us do some customization on the data accessing when using
datasource control....
Here are some related tutorial or msdn reference on ASP.NET 2.0's
databinding and using Datasource control, TableAdapter:
#Binding to a Visual Studio DataSet
http://www.asp.net/QuickStart/aspnet...s.aspx#dataset
#ObjectDataSource Control Overview
http://msdn2.microsoft.com/en-us/library/9a4kyhcx.aspx
#TableAdapter Overview
http://msdn2.microsoft.com/en-us/library/bz9tthwx.aspx
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| NNTP-Posting-Date: Fri, 23 Dec 2005 01:56:19 -0600
| From: Mark Olbert <Ch*********@newsgroups.nospam>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: ASPNET2 Radically Changed from v1.1
| Date: Thu, 22 Dec 2005 23:56:18 -0800
| Organization: Olbert & McHugh, LLC
| Reply-To:
ma**@arcabama.com
| Message-ID: <e6********************************@4ax.com>
| X-Newsreader: Forte Agent 3.1/32.783
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Lines: 42
| X-Trace:
sv3-2vkvCMoImkATxChi91fwCMyfSBAFekgHAyqH20qe1gaPyN5Xcg lRh8+nkyFdA5Mmn33cijYq
pdR2DYe!lkh4NF4DAyyAsJEa66Ev0gO/0ygDEzQxoF8qBIVTFvOLLJgBfeo5Pt7e76a09Fk46mpw
zg==
| X-Complaints-To:
ab***@giganews.com
| X-DMCA-Notifications:
http://www.giganews.com/info/dmca.html
| X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
| X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
complaint properly
| X-Postfilter: 1.3.32
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.d ca.giganews.com!nntp.gigan
ews.com!local01.nntp.dca.giganews.com!news.giganew s.com.POSTED!not-for-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366737
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I'm starting to play around with VS2005 and ASP.NET 2 and have some
questions.
|
| The typical pattern for a data-driven aspx page in v1.1 was data
connection -> data adapter -> dataset -> bound controls. V2 (at
| least by default) doesn't include data connections, data adapters or
datasets in the toolbox when building an aspx page. Nor can I
| find where the DataView component went to. Everything now seems to rely
on the DataSource controls.
|
| Some examples (to which I would appreciate responses on "here's how it's
done in v2"):
|
| 1) If I want to present two different views of the same data -- where I
would previously declare two separate DataView components
| onto the design surface of a page and then bind controls to them -- must
I create two different data sources? This sounds like I'm
| buying into multiple requests against the database for essentially the
same data.
|
| 2) One pattern I used a lot in v1.1 was to define a current record object
(for either the form or a row in a databound control), and
| then use it to return values to display. For example, suppose a record in
the database had two fields, Title and DateChanged. I
| would concatenate these two fields in a protected method called from
within, say, a DataRepeater:
|
| protected string TitleAndDate( DataRowView curDRV )
| {
| some_data_set.row_type strongly_typed_row = (some_data_set.row_type)
curDRV.Row;
|
| return strongly_typed_row.Title + " (" +
strongly_typed_row.DateChanged.ToShortDateString() + ")";
| }
|
| And yes, I know I could do this through databinding expresssions, but
frankly they were a pain in the butt to configure; this way
| may have been less efficient, but it was clearer. At least to me :).
|
| But in v2 the Datasource control doesn't seem to return a strongly-typed
collection of objects. In fact, there doesn't seem to be
| any "knowledge" of the underlying database schema exposed in the return
value of, say, its Select() statement (clearly the schema is
| contained in the Datasource control, but it seems hidden...or at least I
haven't been able to find it).
|
| How do I get access to strongly-typed values from a Datasource control so
I can do things like I was used to doing in v1.1?
|
| Frankly...so far I am deeply underwhelmed by the supposed productivity
improvements in v2. They may be there -- okay, they are
| almost certainly there -- but the overall approach to building websites
is so radically different in ASPNET2 that I'm going to
| suffer a major productivity hit just figuring out how to get started.
|
| It also seems like the v2 framework is more restrictive, in the sense
that it lets you do things simply -- provided you do them in a
| particular way. I understand that's the nature of a framework, but good
frameworks strike a balance between restrictions and
| flexibility. Maybe it's just the radical change from v1.1 to v2, but so
far all I see is a lot more restrictions, and a lot less
| access to the plumbing.
|
| - Mark
|