Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #41 (permalink)  
Old November 15th, 2007, 06:04 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Quote:
quote:Originally posted by forumuser
 cool. here's me on acoustic [after a bottle of wine]....

http://www.podsol.co.uk/mp3/midnighttrain2.mp3

back on topic. this architecture doesn't seem too intuitive to me, even for such a simple situation as the one i outlined earlier. perhaps i should stick with my current method of datasets. we'll see...

like any new 'platform/architecture' TBH does need a little bit of stripping down to see how it all works. i'd advise you to perhaps run flixon over just a single table (tbh_posts for example) and save the result to a new folder. then just browse thro' the resulting files and get a 'map' in your head of how it all hangs together. the key here really is the scalability that you get 'for free' by adhering to the framework. i would admit that to code a new project by hand would be very long winded, but i think even microsoft recognise that some sort of ORM tool is necessary to both keep standards compliant as well as keeping errors out of the code domain. we really should be concentrating our efforts on the BLL (i.e. adding additional functionality here) and the UI layer.

if you want, you can send me a cut down version of the database (with departments/employees etc) and i'll put together a few quick 'n' dirty examples as per your previous request (i.e. to show department name, rather than it's ID). there is a variety of ways to do this, and it's just a matter of looking at each as is 'fit for purpose'.

ok, hope this helps.

btw - only sounded like half a bottle of wine to me - good playing ;). you should check out an old friend of mine's website for nice acoustic stuff:
http://www.davesutherland.co.uk


jimi

http://www.originaltalent.com
  #42 (permalink)  
Old November 15th, 2007, 06:36 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

some very good writing there. i like his style. the band work well together too. i might keep an eye open to see if he ever gets up this way.

that was a kind offer re the examples. i have run flixon a number of times over one or more tables and i thought i was starting to get a handle on it all. however, i'm stumped by what we've been discussing. could you poss run an example on the simple two tables i described above? that would help immensely. i do realise the need for a better structure than datasets. but i don't want to commit to any until i'm clear about how it would all work. i need to be able to recreate all the functionality that currently exists in the application i referred to earlier and displaying a gridview from more than one table is a common requirement.



  #43 (permalink)  
Old November 15th, 2007, 07:26 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - ok, not using those tables mentioned but using the same relationships from the default TBH table. i've created a small project that uses the tbh_posts and tbh_forums tables to represent the 'lookup' functionality that you needed an example of. the only changes i've made, are in the UI (i.e. the default.aspx and code-behind). i've commented where those changes are and hopefully the penny will drop when you see the power that you've got at your 'fingertips'.

anyway, you can pick up the project here:

http://www.originaltalent.com/downloads/tbh_posts_1.zip

let me know if this example fits with your thinking on things.

[edit] you'll obviously need to change the <connectionStrings> in the web.config to point to your instance of the tbh database. mine is declared as Catalog=Originaltalent, so just change that part appropriately.

jimi

http://www.originaltalent.com
  #44 (permalink)  
Old November 15th, 2007, 09:50 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well thanks jimi. that works! i adopted it all to fit my app and it runs. some questions if i may?...

i notice that the ForumTitle method runs for each row. does cacheing stop that making a database request for each row to get the title? [i seem to remember this being discussed in the book]

i see you placed both tables under the one provider. i guess re your previous comments it wouldn't matter if i placed them under separate providers?

i create a new forum object each time the method runs to get the title. do you reckon this is still more efficient than creating a dataset tailored to the gridview fields which contains everything?

interesting though. a very different way of doing things. many thanks again.

  #45 (permalink)  
Old November 15th, 2007, 10:21 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - glad it worked for you. ok, to answer your points:

1. correct, cacheing means that pre-existing cached objects are used, rather than database retrieves. unless of course, a record is changed which causes the database to be queried again (very unlikely but both possible and perhaps desirable).

2. re providers, yes, as i mentioned before where you put the entities is immaterial. organisationally you may elect to put them in seperate providers.

3. i'm not sure how we'd measure that but given that we get the objects from the cache, then it's pretty efficient. we also have the flexibility of adding new methods (either in code behind or in the BLL) without touching any of the data-access code. this is a HUGE plus as it means that any shared functionality will be unaffected by any 'changes' that we may make by adding such new methods. an example of this might be where someone says that they love the layout but could they have certain calculated fields added etc, etc..

the example i gave you is of course only one way of quite a few to achieve the same result. that particular example makes sense with the gridview as it requires very little change to the existing code. of course, you may wish to incorporate dropdowns for editting the department etc and this again would be no problem and would merely require that the department (or in the example i gave you 'forum') function was changed to return an integer value representing the index in the dropdown list of departments (i.e. you'd change the asp:Literal to an asp:DropDownList in a similar way to the way that it's wired in the Edit.aspx page).

hope you can see a little bit more than the tip of the iceberg regarding the flexibility of the framework. even if you decide not to adopt it, it should hopefully have given you some insight for the future.


jimi

http://www.originaltalent.com
  #46 (permalink)  
Old November 15th, 2007, 10:31 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes, the light is [slowly] brightening :)

what about being able to create objects from a database 'view'? would that not be an option worth considering?

  #47 (permalink)  
Old November 15th, 2007, 10:44 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - yes, that's an option. however, you'd then have entity mapping issues to resolve. if you have all the required parent/child objects to hand, then you should be able to manipulate those in memory to present the data as per the little example. i can see exactly where you're coming from but again see this as a backward 'comfort-zone' approach to solving a problem, rather than looking at the expanded vocabulary that the toolset now presents you with.

of course, until you are au fait with what's possible, then it'll always be easier to deliver based on a hybrid approach. however, in later stages i can assure you that you'll WANT to go back and change those sections to fit with your standards.

i come from a vb/c++/c# background and never touched classic asp or vbscript. as such, i'm always happier playing with object structures, so your mileage may vary from mine. suffice to say, i can 'see' the solutions to many of the issues that need to be tackled inside the objects and just really need to get down to doing the donkey work a lot of the time :).

any questions, just post them here.

jimi

http://www.originaltalent.com
  #48 (permalink)  
Old November 15th, 2007, 10:54 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well of course, you hit the nail on the head with the 'comfort zone' thing! i thought that perhaps doing some logic at the database would remove the need to deal with things out in the bll or elsewhere. but i agree, i need to stick with it. i'm feeling a little out of my depth here but am keen to continue.
one thing which appeals about tbh architecture is that there is no 'black box' to believe in, no required dlls which [claim to] do the nuts and bolts stuff, unlike a lot of others i have investigated. and i agree with an earlier remark of yours, it does look to be an elegant structure with a small footprint.
i'll need to re-work the templates as i do all data access via stored procedures but that apart, i think tbh does look like a good contender.
thanks for all your help this far. that's a beer [or 2] i owe you.

  #49 (permalink)  
Old November 15th, 2007, 11:05 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - yes, if you had elected to use views, then you'd have to query it on the database everytime as you wouldn't know if any/all tables had changed in the interim. using the object structure, you could in theory return the main object along with a child collection from the cache and query the database for a second child collection. that way every little bit of dependant data is totally up to date and only taken from the database when an amendment is made to that table.

i'll have to be honest, i haven't read the book and have instead developed a few in-house and external apps which have been the biggest learning tool. i have refenced the book when a concept wasn't totally clear (or if i didn't find an answer on here) and a combination of all of the above (plus TIME) has given me the knowledge and confidence in this framework. i think you'll do just fine, espcially as you tackle tougher calls and find that the solution is actually already there (trust me, this will happen).

as for the beers - london pride or speckled hen please!! ;)

jimi

http://www.originaltalent.com
  #50 (permalink)  
Old November 15th, 2007, 11:13 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

another nice example (funnily enough today) of using a function referenced in the code-behind can be found here. this should hopefully let you see the enormous power at play using this technique:

http://p2p.wrox.com/topic.asp?TOPIC_...22&whichpage=8

hope you understand the concept max is playing with - it's quite nice.

jimi

http://www.originaltalent.com
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
THB old Template... it´s time for a new look kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 October 5th, 2007 05:42 PM



All times are GMT -4. The time now is 08:59 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.