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
  #11 (permalink)  
Old September 24th, 2007, 04:25 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jimibt
 alex,

right, sounds a bit odd. you should be able to see the TBH tables in that view too. just wondering if there's a 'conflict' in the name of the mdf file (i.e. the aspnetdb namespace is already perhaps registered to another db installation somewhere. as a 1st approach, i'd try to copy your working TBH database as beerhouse.mdf (along with the ldf file). and then try pointing to that to see what happens.

let me know how you get on.


jimi

http://www.originaltalent.com
Jimi,

same thing happens...

Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
  #12 (permalink)  
Old September 25th, 2007, 03:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Alex,

One more thing to try. Do you have SQLServer Management Studio Express?? If so, then open the Connection for SQLExpress and then open the Databases treeview item. next select the named database that you had attqached (i.e. you may have renamed it to beerhouse.mdf, so it should be attached as beerhouse. Now check by opening the tables treview item on that database to see if you can see the tbh_* tables.

once we get to this stage, we can troubleshoot from there.

jimi

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

Alex,

Just had a look at the default 'attach' method in the site generator and have found that it can encounter a small error when connecting and actually 'approximate' the database that it's trying to attach. anyway, best way to go about this is to go into SQLServer management studio express and attach the database from there. when it's attached, rename the attachment to a 'single' entity name (i.e. you may see it attached as c:\temp\data\mydatabase.mdf, so just rename this to anything you like, i.e. mydatabase). then open the site generator and in the DB Path/Name name box, type mydatabase (or whatever the name was that you decided upon in sqlmgt express) and check the integrated security box. now follow the steps as you had before and 'hopefully' you'll see the correct tables being shown.

i'll look into getting this error resolved as it looks like a pretty simple try/catch block that's gone awry in the attach code.

thanks for bringing it (unwittingly), to my attention.

jimi

http://www.originaltalent.com
  #14 (permalink)  
Old September 25th, 2007, 09:58 AM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by jimibt
 Alex,

Just had a look at the default 'attach' method in the site generator and have found that it can encounter a small error when connecting and actually 'approximate' the database that it's trying to attach. anyway, best way to go about this is to go into SQLServer management studio express and attach the database from there. when it's attached, rename the attachment to a 'single' entity name (i.e. you may see it attached as c:\temp\data\mydatabase.mdf, so just rename this to anything you like, i.e. mydatabase). then open the site generator and in the DB Path/Name name box, type mydatabase (or whatever the name was that you decided upon in sqlmgt express) and check the integrated security box. now follow the steps as you had before and 'hopefully' you'll see the correct tables being shown.

i'll look into getting this error resolved as it looks like a pretty simple try/catch block that's gone awry in the attach code.

thanks for bringing it (unwittingly), to my attention.

jimi

http://www.originaltalent.com
Jimi,

Thanks, that did the trick. I just used one Provider I called "Posts" and I associated it with the tbh_Posts table. Could you please go into more detail of what these providers are? I'll have to set some time aside to take a look at the generated files, its been a long time since I played around with TBH, I forgot everything already.

I like the beerhouse architecture, but I've received comments from others that it has too much layering. Whatever that really means is questionable. But have you used something like NHibernate? I just installed it, haven't done much with it yet, If you (or anyone else) used it before, how would you compare it to TBH architecture, is it easier/quicker to use and manage?

Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
  #15 (permalink)  
Old September 25th, 2007, 10:17 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Alex,

glad that helped. the 'providers' are basically just a 'posh' word for the different 'buckets' that the various entities go into. for example, if you look at a standard tbh BLL folder, you'll see that there are sub folders named:

articles, forums, newsletters etc, etc, etc...

also, in the DAL, you'll see files with names like forumsprovider.cs etc..

basically, when you create a provider name, that is where all the code associated with that table (or tables) is stored (ie articles forums etc).

hope this helps. as fot NHibernate, i haven't looked at it in any great detail as i've 'adopted' tbh as my core architecture for now. not sure if i agree about there being too much layering as you soon begin to understnad the reasons for the separation, the more you use it in anger.

glad you've got it going. I'd suggest that when 'playing' with the site generator, you do as you did (i.e. created a Posts provider and pointed it to the tbh_posts table, as well as perhaps adding another provider (articles for example), so that you'll see how it builds up the structure.

good luck!!

jimi

http://www.originaltalent.com
  #16 (permalink)  
Old September 26th, 2007, 04:48 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jimi,

The generator is nice. Are you planning to add support for parent-child relationships through PKs/FKs ? I am referring to an example such as the relationship between Categories and Articles - Marco has a set of these procedures in the SqlArticlesProvider.cs such as:

 /// Retrieves all articles for the specified category
      public override List<ArticleDetails> GetArticles(int categoryID, int pageIndex, int pageSize)

That would be really nice...

As far as NHibernate, I've just finished doing a very basic data retrieval. I can't say I fully understand just yet how easy it would be to maintain, or tie the database to ObjectDataSources, etc.
The ODS tie-ups is what underlines the beauty of TBH for me...

Hibernate looks nice too however, it reminds me of the RogueWave DBTools.h libraries.. If you ever do find the time to explore NHibernate further, please post here how you think it compares with TBH's custom entity approach. I'd be really curious to hear the opinion on this ORM from someone like you, who has been working with automating the generation of custom entity code.

There are also other generators I've looked at such as NetTiers, but they produce way too much code, and I like the simple approach of TBH.
So now, its a toss-up between NHibernate and TBH architecture :)


Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
  #17 (permalink)  
Old September 27th, 2007, 04:02 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Alex,

Yes, and yes again. the ongoing 'development plan' for the site generator is to be able to take any table (or set of tables) and based on PK&FK's, generate the parent child collections (LIST <T>). Also, what isn't there at the moment is the 'holy grail' of ORm's, composite PK's. THis should in theory be quite easy but it's actually quite tricky to get watertight in practice. As i've mentioned before, the primary development of the site generator isn't actually by me, it's by the guy 'Lee' who runs flixon. I've merely added pedestrian functionality and re-worked the ergonomics of the application. i'll quiz him to see how the support for FK collections is going, as well as a few other 'nice' things that are in the pipeline.

for the timebeing, i've put up a copy of a revised set of templates that i use that includes (among other things) the use of a generic paged dataset stored procedure. this is actually very very powerful and i'd urge you to take a look at it's 'elegance' :).

let me know how you get on with it (if you've got the time). you can grab the zip here:

http://www.originaltalent.com/downlo...Templates1.zip

once downloaded, rename your existing C:\Program Files\Flixon\Site Generator\Templates to C:\Program Files\Flixon\Site Generator\Templates(default) [or something like that], then extract the zip file into C:\Program Files\Flixon\Site Generator\. next, add both the stored procedues (genericPagingCountSQL.txt and genericPagingCount.txt) to your tbh database and then fire off the site generator against a couple of test providers.

next, sit back and be amazed :) - enjoy....

jimi

http://www.originaltalent.com
  #18 (permalink)  
Old September 27th, 2007, 03:14 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jimi,

Please forgive my ignorance, but what is the usefulness of the paged dataset procedures? Does it have something to do with paging and the datagrid? I remember reading that asp.net 2.0 supports paging and if I remember reading from Marco's book, he shows up how to use it. Are these procedures introducing something new? Again, sorry, I am very new to asp.net, and I have a tendency to jump in topics without learning the basics sometimes.

I added the two stored procedures to my database, and tried executing the site built with the Site Generator - I am getting the following error:

Server Error in '/TestSiteGen' Application.
Procedure or function 'genericPaging' expects parameter '@orderBy', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'genericPaging' expects parameter '@orderBy', which was not supplied.

Source Error:

Line 44: protected IDataReader ExecuteReader(DbCommand cmd, CommandBehavior behavior)
Line 45: {
Line 46: return cmd.ExecuteReader(behavior);
Line 47: }
Line 48:


I figured I'd ask first before starting to dig in the code... :)

I am also wondering if I went about the right way to incorporate the generated site files with a new site. I chose "New Web Site", the site project got created, then I added a new ASP.NET folder App_Code. Then I copied the App_Code folder generated by Flixon into the porject directory to replace the App_Code folder created by Visual Studio. I also added a reference to the project to the AjaxControlToolkit.dll (from the Temp folder in the Site Generator). Is this the way you go about it when you create a new site, or is there a simpler way?

Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
  #19 (permalink)  
Old September 27th, 2007, 03:48 PM
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 rocco50
 Jimi,

Please forgive my ignorance, but what is the usefulness of the paged dataset procedures? Does it have something to do with paging and the datagrid? I remember reading that asp.net 2.0 supports paging and if I remember reading from Marco's book, he shows up how to use it. Are these procedures introducing something new? Again, sorry, I am very new to asp.net, and I have a tendency to jump in topics without learning the basics sometimes.

I added the two stored procedures to my database, and tried executing the site built with the Site Generator - I am getting the following error:

Server Error in '/TestSiteGen' Application.
Procedure or function 'genericPaging' expects parameter '@orderBy', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'genericPaging' expects parameter '@orderBy', which was not supplied.

Source Error:

Line 44: protected IDataReader ExecuteReader(DbCommand cmd, CommandBehavior behavior)
Line 45: {
Line 46: return cmd.ExecuteReader(behavior);
Line 47: }
Line 48:


I figured I'd ask first before starting to dig in the code... :)

I am also wondering if I went about the right way to incorporate the generated site files with a new site. I chose "New Web Site", the site project got created, then I added a new ASP.NET folder App_Code. Then I copied the App_Code folder generated by Flixon into the porject directory to replace the App_Code folder created by Visual Studio. I also added a reference to the project to the AjaxControlToolkit.dll (from the Temp folder in the Site Generator). Is this the way you go about it when you create a new site, or is there a simpler way?

Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
Alex,

Basically, allow the site generator to do 'all the work' then open the website from the folder that you pointed the site generator to. all you need to do (to test a website), is to copy the C:\Program Files\Flixon\Site Generator\Temp\bin to your app folde, as well as copying C:\Program Files\Flixon\Site Generator\Temp\Admin to your app folder. you don't need to create new projects from vs2005 etc..

ok, paging!"! where to start. the genericpaging sql that i supplied is a 'backend' solution which works in tandem with the objectdatasource. in the standard tbh, you can see various examples of this in action (for example \App_Code\DAL\SqlClient\SqlForumsProvider.cs public override List<PostDetails> GetThreads(string sortExpression, int pageIndex, int pageSize) uses the same kind of logic in-line to allow tbh_posts to be 'paged'). however, all examples use bespoke SQL to achieve the result, the genericpaging sql works with ANY table.

hopefully, i've explained this as briefly and as detailed as possible to get you reaping HUGE benefits from this approach. of course, once you delve into this area, you realise that almost anything can become 'generic', which then creates the risk of not focussing on the task at hand, instead 'glossing' over the intracacies
- so, as they say 'caveat emptor' (or something like that) :)


jimi

http://www.originaltalent.com
  #20 (permalink)  
Old September 27th, 2007, 04:38 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jimi,

Again, I am very new to asp.net, and took a break in my learning it, but I recall there is a GridView attribute - AllowPaging="True". What advantage does the paging dynamic SQL code provide?

About generics - its my biggest setback. :) I am spending way too much time trying to understand TBH, how to do things right from the get-go, and how to generalize my development, instead of learning ASP.NET basics..

Alex

- TheBeerHouse Mods Repository
http://www.sashka.com/TheBeerHouse/thebeerhouse.html
 


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 12:06 PM.


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