Change the namespace

Topics: Developer Forum
Apr 17, 2008 at 5:14 AM
I love this StarterKit, I have learned so much. However, I must admit, I am a newbie. I am building a website for my church's youth group and learning ASP .NET whilst trying to teach underprivlidged kids something about computers(NOTE: whilst I work in the IT industry, I am an IT manager and not a programmer, discounting my work in COBOL/DB2 on an IBM mainframe). The namespace is TheBeerHouse, however that is inappropriate for the youth group. Espiecally, as I plan to show/teach them the "insides" of the code (to the extent possible). Question, how can I remove the reference to TheBeerHouse and MB.TheBeerHouse? I have been able to remove none code references to beer, for example replacing the beer rating with a "gif" of a penny. Removing the articles, etc. Please help.
Apr 18, 2008 at 4:24 AM
Is this forum still in use?
Apr 21, 2008 at 1:20 PM


meamea wrote:
I love this StarterKit, I have learned so much. However, I must admit, I am a newbie. I am building a website for my church's youth group and learning ASP .NET whilst trying to teach underprivlidged kids something about computers(NOTE: whilst I work in the IT industry, I am an IT manager and not a programmer, discounting my work in COBOL/DB2 on an IBM mainframe). The namespace is TheBeerHouse, however that is inappropriate for the youth group. Espiecally, as I plan to show/teach them the "insides" of the code (to the extent possible). Question, how can I remove the reference to TheBeerHouse and MB.TheBeerHouse? I have been able to remove none code references to beer, for example replacing the beer rating with a "gif" of a penny. Removing the articles, etc. Please help.




I'm currently reading the Book and starting my own site with this Starter Kit. Then I'm going to tackle creating my church's website base on this starter kit also. I have gone into Project properties and changed the default namespace of the project. Then I just did a find and replace for the whole solution. I'm sorry I haven't written the specifics on how this is done but I'm pressed for time. If you have any question post back. I plan on checking this forum out often
Apr 22, 2008 at 4:32 AM
Hello

Thanks so much for replying. Previously I went into the TBHCustomEvents Property page and changed the Assembly name and the Default namespace. Is this what you did? I then did a global replace of MB.TheBeerHouse with the new value. However, I get many errors. Most are on the Template Master, stating things like "mb.themeselecter" is not a resourcce, are you missing an assembly (I am paraphrasing).

I am very curious how you did it.

Cheers
Apr 22, 2008 at 4:37 AM
Hello gadkins,

I tried it again. I again went into the TBHCustomEvents Property page and changed only the Default namespace, not the Assembly name. Next I changed "namespace = MB.TheBeerHouse" as well, I did a change of "using MB.TheBeerHouse" and again, I got the same errors. Curious how you did it. Do you need to register the DLL when you are done. NOTE: I am using Vista.

Cheers,
Michael
Apr 22, 2008 at 12:08 PM
Edited Apr 22, 2008 at 2:38 PM
The TBHCustomEvents page is a separate project. The only thing that changing the default namespace will do it any classes that you add to your project will now have the namespace you want. I renamed the TBHCustomEvents project to GACustomEvents. I then had to bin directory of the web project and remove the referance to TBHCustomEvents and add a new reference to GA.CustomEvents. Also change the assembly name of GACustomEvents to get rid of the Beer house. You do this by right clicking The CustomEvents project and selecting properties on the Application Tab. As for the theme selector I haven't added that to my master page yet. (I'm creating my own master page and styles). I'll do that this morning and tell you how it goes. But I'm thinking that your using or namespace wasn't changed in your ThemSelector.ascx.cs file. Also check to make sure your namespace on the TemlateMaster class is set to your new name space. Mine is GA.GregoryAdkins.UI. Do a find on the entire solution for Beerhouse just to make sure you changed everything that you needed to.


EDIT. ALso.

On your templete master page. where you see this.
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Template.master.cs" Inherits="GA.GregoryAdkins.UI.TemplateMaster" %>
<%@ Register Src="Controls/ThemeSelector.ascx" TagName="ThemeSelector" TagPrefix="mb" %>
<%@ Register Src="Controls/PollBox.ascx" TagName="PollBox" TagPrefix="mb" %>
<%@ Register Src="Controls/NewsletterBox.ascx" TagName="NewsletterBox" TagPrefix="mb" %>
<%@ Register Src="Controls/ShoppingCartBox.ascx" TagName="ShoppingCartBox" TagPrefix="mb" %>
<%@ Register Src="Controls/PersonalizationManager.ascx" TagName="PersonalizationManager" TagPrefix="mb" %>
<%@ Register Src="Controls/WelcomeBox.ascx" TagName="WelcomeBox" TagPrefix="mb" %>
<%@ Register Src="Controls/RssReader.ascx" TagName="RssReader" TagPrefix="mb" %>

Make sure you change the bolded statement to point to your new namespace.
Apr 23, 2008 at 5:54 AM
Cool, i will try tomorrow. Right now now I have some work related issues, lol, to much work. ;)
Apr 24, 2008 at 6:09 AM
Hmmm...I hope it is not because I am on Vista...but I am still facing the problem? I wonder if I have to register a DLL or something. Maybe if you see the errors I am getting (doing what you suggested I do above) you might recognize one that you experienced and might be able to help me get over the hump? NOTE: what you asked me to do, I have previously done (or at least I think I did), regardless, I decided to try again, this time creating a new namespace (i.e., using a namespace I did not use before, so almost, shall we say, trying from scratch). When I do this, I do see new files created in the folder called: TBH_CustomerEvents that matches the names I provide, the time stamps of these files match the time I press the "F5" button to run the code. However, as I state, I still get my 17 errors.

First, to show you what I did.

_______________________________________________________________________________________________________________________________________________________

My Template Master reads:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Template.master.cs" Inherits="EA.ErnstAllen.UI.TemplateMaster" %>
<%@ Register Src="Controls/ThemeSelector.ascx" TagName="ThemeSelector" TagPrefix="mb" %>
<%@ Register Src="Controls/PollBox.ascx" TagName="PollBox" TagPrefix="mb" %>
<%@ Register Src="Controls/NewsletterBox.ascx" TagName="NewsletterBox" TagPrefix="mb" %>
<%@ Register Src="Controls/ShoppingCartBox.ascx" TagName="ShoppingCartBox" TagPrefix="mb" %>
<%@ Register Src="Controls/PersonalizationManager.ascx" TagName="PersonalizationManager" TagPrefix="mb" %>
<%@ Register Src="Controls/WelcomeBox.ascx" TagName="WelcomeBox" TagPrefix="mb" %>
<%@ Register Src="Controls/RssReader.ascx" TagName="RssReader" TagPrefix="mb" %>
....
_______________________________________________________________________________________________________________________________________________________

CustomerEvents C# code reads:

using System.Web.Management;

namespace EA.ErnstAllen
{
public abstract class WebCustomEvent : WebBaseEvent
{....

_______________________________________________________________________________________________________________________________________________________

ShowThreads.aspx.cs code reads:

using EA.ErnstAllen;
using EA.ErnstAllen.BLL.Forums;

namespace EA.ErnstAllen.UI
{
public partial class ShowThread : BasePage
{
....

_______________________________________________________________________________________________________________________________________________________

Again, the purpose of showing the C# code was just to randomly sample the C# using and namespace changes made when I globally replace "MB.TheBeerHouse" with "EA.ErnstAllen", which changed 346 entries.

On the EACustomEvents (i.e., TBHCustomerEvents) the asscemly name is "EA.ErnstAllen.CustomEvents" and the default name space is "EA.ErnstAllen".

When I compile I get 17 errors, 13 of which read something like this (these are two of teh 17):

Element 'ThemeSelector' is not a known element. This can occur if there is a compilation error in the Web site. C:\ErnstAllen\TBHWeb\Template.master 108 14 C:\ErnstAllen\TBHWeb\
....
Element 'WelcomeBox' is not a known element. This can occur if there is a compilation error in the Web site. C:\ErnstAllen\TBHWeb\Template.master 132 29 C:\ErnstAllen\TBHWeb\
....

One states:
C:\ErnstAllen\TBHWeb\Admin\ManagePolls.aspx: ASP.NET runtime error: The file '/TBHWeb/Template.master' cannot be processed because the code directory has not yet been built. C:\ErnstAllen\TBHWeb\Admin\ManagePolls.aspx 1 1 C:\ErnstAllen\TBHWeb\

One states:
Could not load file or assembly 'EA.ErnstAllen.CustomEvents' or one of its dependencies. The system cannot find the file specified. C:\ErnstAllen\TBH_Web\web.config 154

And one states:
C:\ErnstAllen\TBHWeb\ShowThread.aspx: ASP.NET runtime error: The file '/TBHWeb/Template.master' cannot be processed because the code directory has not yet been built. C:\ErnstAllen\TBHWeb\ShowThread.aspx 1 1 C:\ErnstAllen\TBHWeb\

Any ideas?
Apr 24, 2008 at 11:45 AM
I think I got this before. Close all you tabs that you have open in your project --> right click the solution in solution explorer and click clean solution. Then click on the build menu and choose build solution.

As for this error
Could not load file or assembly 'EA.ErnstAllen.CustomEvents' or one of its dependencies. The system cannot find the file specified. C:\ErnstAllen\TBH_Web\web.config 154

you neeed to remove the old custom events dll from the bin webfolder and add you new modified one.
Apr 25, 2008 at 3:48 AM
LOL, golden!!!!!!! Seems I did this right the first time!!!!!! But what did I miss, well, I missed the placing of ''EA.ErnstAllen.CustomEvents'' custom events dll in the bin webfolder.

Thank you so much, that was perfect!!!!!!!! Really, really, really appreciate it!!!!!

Did I tell you I really appreciate it!!!

So what is next for you with respect to this site? What features do you plan to add or change?

Hey, I owe you one!
Apr 25, 2008 at 3:57 AM
Cool. I'm working on a new template right now. But I didn't realize how bad I was at website stylesheets. Eventually, I would like to add some silverlight pages to the site for family members and such.
Jun 2, 2008 at 4:18 AM
Hey, How are you doing?  Did you ever get your site published on a remote server?  I saw you had a post about clear text passwords, so I am assuming you are still doing work.  For the first time I have attempted publish my site.  I get an error when I attempt to publish the user defined function called "fn_diagramobjects" to my web-site hosted by GoDaddy.  The error is:

"User-defined function fn_diagramobjects has the execution context ExecuteAsUser. Scripting user-defined function with the execution context ExecuteAsUser is not supported.(SqlPubWiz)"

As you know, I am using the "TheBeerHouse" as a base, and on my local machine this "user defined fucnction" works just fine.  When I use the "Database Publishing Wizard" (DPW) I get the above listed error.  So, in essence DPW is telling me I cannot deploy this user defined function called "fn_diagramobjects" (which I have not altered).
Do you have a work around?
Jun 2, 2008 at 11:58 AM


meamea wrote:
Hey, How are you doing?  Did you ever get your site published on a remote server?  I saw you had a post about clear text passwords, so I am assuming you are still doing work.  For the first time I have attempted publish my site.  I get an error when I attempt to publish the user defined function called "fn_diagramobjects" to my web-site hosted by GoDaddy.  The error is:

"User-defined function fn_diagramobjects has the execution context ExecuteAsUser. Scripting user-defined function with the execution context ExecuteAsUser is not supported.(SqlPubWiz)"

As you know, I am using the "TheBeerHouse" as a base, and on my local machine this "user defined fucnction" works just fine.  When I use the "Database Publishing Wizard" (DPW) I get the above listed error.  So, in essence DPW is telling me I cannot deploy this user defined function called "fn_diagramobjects" (which I have not altered).
Do you have a work around?

meamea, I haven't done much work on my site.  Stylesheets and the design are giving me some trouble.  Not to metion the very large project at work I'm working on.  I don't any experience with the DPW.  Is there a why to swith the context of the executing user?  If not why not try to deploy the fn_diagramobects function manually,  Rick click on the fn_diagramobjects function copy script to clipboard and run on the GoDaddy Server.