I have had difficulty understanding namespaces too, since this book is the first time I have really worked with them.
Basically, a namespace creates an "inheritance" hierarchy. So when you use "Accounts.Business" for example, the methods and properties belonging to that namespace are accessible to you.
I have experimented with the code quite a bit, and I got some insight struggling with the an invalid cast exception with authentication, only to find after trying using every namespace in every combination possible that I had not modified the web form generated code to initialize the base page before the rest of the page.
You may notice that sometimes, with regards to authentication using the namespace Wrox.WebModules.Accounts.Business, the namespace you specifically need does not work until you include a namespace higher up the hierarchy. I have encountered situations (maybe because I am tinkering with the code) where you have to include the namespace above it.
using Wrox.WebModules.Accounts;
using Wrox.WebModules.Accounts.Business;
I had to use both namespaces to traverse the namespace hierarchy in code and have access to the properties and methods needed.
I hope this helps.
|