 |
BOOK: ASP.NET Website Programming Problem-Design-Solution  | This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

February 9th, 2006, 01:05 PM
|
|
Registered User
|
|
Join Date: Nov 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
HELP!! Reusing the Webmodules in a non web app
My application has grown so huge and I am glad I followed the design principles in this book as I knew from the start that the enterpise application I designed would be huge.
I haven't looked at the MS Application Blocks Config Block but will have a good look at I read the newest version (.net 2) came out recently. I have in the past looked through the .net version 1 App Blocks but they look confusing and it wasn't really obvious how I could incorporate them into my app. I searched through the forums and couldn't find a thread about integrating the MS app block with thePhile app.
Anyway will look at ASP.net website for how to integrate the block into my apps.
I do hope the new book (.net 2) will incorporate the the MS application blocks and explain the use of them using the multier model. Amazon says the new book is only coming out in May which is still far away. :(
Since the last book uses SQL Server Stored Procedure I wonder if the new book will use the .net programming stored in SQL Server 2005. Lots of descision to make by the author regarding this as all the technologies seem to be converging and he will have lots of choices to make of what to use in the book. e.g MS app blocks, Sql server 2004 .net code etc. I do hope he goes best practice as the thing I want in a book is to bring all the best practice into a big enterpise app. Wrox are you listening? :)
Anyway, thanks for the detailed response. I see Wrox have brough out a bunch of spesific books on .net 2 and will have a look though those. I guess it's time for me to better understand the topics so that I can rewrite the business, config and data layers to be best practice and for non web apps.
|
|

February 10th, 2006, 02:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is only an ASP.NET application. There's no possible way to implement this functionality in a Console application.
What are you trying to do with your console app? I can't understand why you'd want to do this.
|
|

February 11th, 2006, 01:36 AM
|
|
Registered User
|
|
Join Date: Nov 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I want to use the same web business objects/projects in my console application so that I can reuse some of the methods of those business objects.
In my console app I call methods in 2 business classes - retrieve and save methods (so I added in VS the business, config and data classes) to my console solution to be able to reuse those projects)
Here is what I did to make it work.
First I don't have the Web.Config which references the config file I want to get the ConnectionString from.
So I added a App.Config and added a ConnectionString key with the Database connectionstring. (I coulnd't manage to reference the same ConfigSetting file in my App.Config as was in my Web.Config, I think it has something to do with my Console App being in a sub directory of my application directory and the refrence to that web app "add key" config file didn't work despite me trying adding "..\" to the key)
I added the following to my ModuleConfig class' GetSettings method.
(the bits I added are in bold)
public class ModuleConfig
{
public static ModuleSettings GetSettings()
{
HttpContext context = HttpContext.Current;
ModuleSettings data=null;
try
{
data = (ModuleSettings)context.Cache["StoreAdmin_Settings"];
}
catch (System.NullReferenceException)
{ //just for if not web Application
data = new ModuleSettings();
data.ConnectionString=ConfigurationSettings.AppSet tings["ConnectionString"];
}
You can see all I do is catch the NullReferenceException error that would have accured because it isn't a web app and then update the data object with the correct connectionstring from my App.Config.
------------
It's like hack. Any comment or better way to do this?
The main reason for doing this is reusing the web app business objects in a console or windows app.
Do you understand know what I want to do?
Thanks
|
|

February 12th, 2006, 10:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You have the wrong approach. The user interface is really the main reason for this application. If you don't want the user interface, then there's really no point in using any of this code. How would your users use this system? Would they run your console app from their computer? Have you considered how ugly a console user interface is, and that your users would be unhappy?
If you really can't do a web interface, then you could design a Windows Forms app, and possibly even deploy it over the web as a smart client application. But this is a completely different way to build an application, and you surely can't make use of ThePhile. Why not get yourself a book on Beginning Windows Forms?
|
|

February 13th, 2006, 12:22 AM
|
|
Registered User
|
|
Join Date: Nov 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I don't use the exact ThePhile code but have my own web app based on the multi-tier objects model as used in this book ASP.NET Website Programming Prob-Design-Solution. I aready have a web app so I don't want to replace the web app user interface with a console or windows application.
However I have a SMS based functionality that has to be scheduled to run at a certain time of day and that you can't do with a web app. This job SMS's spesific set of users based on a resultset given to it by the same business project as is in my web application and stores the result of the SMS action of my business project using the SAME business method that is used in my web app.
The same Business Project methods are used BOTH by my web app and by console app.
The main reason I do this is to REUSE the same CODE.
I want to seperate the PRESENTATION LAYER from the business layer so I see no reason why I can't call the business layer classes from a console or windows app. I don't want to reuse the aspx pages but only the business classes.
I thought the whole purpose of this book is to teach you have to write a multi-tiered Object Orientated Application. I don't use thePhile but have based my application by coding the exact way and using the same Business, Config, Data classes way of programming my web app.
I couldn't find a better book than this one to teach me multi-tier programming so that is why I used ASP.NET Website Programming Prob-Design-Solution as it was the only multi-tier book I could find.
If I am using the wrong book can someone then point my in the right direction. E.g another book or website. What I want to do is seperate the presentation layer from the business layer and the business layer from the data layer using .net irrespective if it's a web, windows or console app.
Thanks.
I hope this describes it better.
|
|

February 13th, 2006, 11:40 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for clearing that up! Your solution looks reasonable, but the whole notion of HttpContext doesn't apply to .exe applications. Your inheritance tree is likely tied to asp.net (I can't look at the code right now, but you may find this to be true).
You're 100% right that a true business layer should have no knowledge of whether his caller is a web app, windows app, or whatever. This is part of the reason MS came up with the Configuration Management application block - to help manage config items in a multi-tier application. I'm sure you'll love this if you haven't already seen it.
The problem with this book is that they took "multi-tier" to mean "DB/DAL/BLL/Presentation", but all these had web underpinnings because the authors are mostly web developers and their idea with modules was to allow them to be used in another WEB application. They didn't give serious consideration to the other options: Console, Win Form, Win Service, Web Service, Enterprise Service (COM+), etc.
Your solution options vary widely: on one hand you could redesign the BLL and DAL to remove all web-ish aspects, or a simpler approach is what you've done (a shoehorn - not as terrible as it may seem, but definitely not elegant). Or you could focus on adding a new web service that can be called from console or Win Form apps - this is a cool option.
Or you can make an abstract configuration provider class, and provide an implementation that is specific to each platform (following the provider design pattern). This becomes very elegant, but requires more architecture changes.
The second edition of this book will be out soon. It's also pretty much tied to ASP.NET, but the whole concept changes. This time the author is fully leveraging more canned functionality provided by MS in ASP.NET 2, so the code he writes focuses more on the functional area, and not the internal plumbing.
But your immediate concerns would be best met by studying Service Oriented Architecture. This is one of those areas that seems complex because they like to throw around big words, but the ideas are simple and obvious: give small isolated blocks of functionality that communicate thru well-defined interfaces. Despite the name, SOA communication is not necessarily tied to web services. You can use many kinds of "transports", which can even be in-process in some cases (nothing more that calling a library function). By the way, this line of study will set you up for Indigio (Windows Communication Foundation), which is coming REAL SOON!
Your system is growing and it needs to scale. This is easy to "patch" to make it work in the short term, but true scalability is a bit harder. Scaling can happen in terms of platforms, functions, usage, etc, but the underlying architecture needs to support this scaling. Your life is getting more interesting!
|
|

February 19th, 2006, 07:04 PM
|
|
Registered User
|
|
Join Date: Nov 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
My application has grown so huge and I am glad I followed the design principles in this book as I knew from the start that the enterpise application I designed would be huge.
I haven't looked at the MS Application Blocks Config Block but will have a good look at I read the newest version (.net 2) came out recently. I have in the past looked through the .net version 1 App Blocks but they look confusing and it wasn't really obvious how I could incorporate them into my app. I searched through the forums and couldn't find a thread about integrating the MS app block with thePhile app.
Anyway will look at ASP.net website for how to integrate the block into my apps.
I do hope the new book (.net 2) will incorporate the the MS application blocks and explain the use of them using the multier model. Amazon says the new book is only coming out in May which is still far away. :(
Since the last book uses SQL Server Stored Procedure I wonder if the new book will use the .net programming stored in SQL Server 2005. Lots of descision to make by the author regarding this as all the technologies seem to be converging and he will have lots of choices to make of what to use in the book. e.g MS app blocks, Sql server 2005 .net code etc. I do hope he goes best practice as the thing I want in a book is to bring all the best practice into a big enterpise app. Wrox are you listening? :)
Anyway, thanks for the detailed response. I see Wrox have brough out a bunch of spesific books on .net 2 and will have a look though those. I guess it's time for me to better understand the topics so that I can rewrite the business, config and data layers to be best practice and for non web apps.
PS. If anyone figures a nice way to remove the asp.net code from the business,config and data layer, and removing HttpContext from the config module then please post the solution.
The WebModules will just have to be called Modules but that's the easy part. :)
|
|

February 20th, 2006, 01:33 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It's hard to add the app blocks to an existing app - you really have to design your app around them. But you can learn a lot by studying their code, even if you don't roll them into your app.
The second edition won't cover the app blocks. The point in the second edition is to teach you how to develop real-world web sites by leveraging as much of the built-in functionality as possible. It's not really a book about architecture, but he does go into the multi-tier thing a bit deeper (and he does a lot of caching at the BLL level, which speeds up the site).
I'm sorry to say that I don't know of an excellent architecture book that's totally up-to-date. I think I'd have to say that Rocky's books are possible choices, but I'm not completely sold on his CSLA, and it's a bit complex for someone of your level:
http://www.lhotka.net/
You need to design your own business classes. It's really not that hard. It's a LOT easier than designing your own pages! It all comes down to inputs and outputs. Why is HttpContext used in ThePhile? Does it need to be used at the BLL level? How could you pass in the needed info so it doesn't need to reference that object?
|
|
 |