How would you handle needed "System" class/table/form in application?

R

Ronald S. Cook

I'm just curious how you would handle this. In the cable industry, Comcast
is referred to as an "MSO" (multiple systems operator) meaning they own many
cable systems. Therefore a solution must be architected to accommodate
"System" as an entity. This means a table in the database named System, a
class System, a web form System, etc.

Since System is such a reserved word, how should we do this? To rename it
"CableSystem" would bug as isn't consistent/what is desired (should have to
change our business terminology because conflicts with development tool).
For the class, it could be named "System" and just wrapper a namespace
around it named "Classes". But for the web form, while it could be named
System.aspx, you can't just wrap a namespace around it.

Hungarian notation is "out" these days so I'm looking for a good
standardized and consistent approach for all such names that might conflict.

Thanks,
Ron
 
J

Jon Skeet [C# MVP]

Ronald S. Cook said:
I'm just curious how you would handle this. In the cable industry, Comcast
is referred to as an "MSO" (multiple systems operator) meaning they own many
cable systems. Therefore a solution must be architected to accommodate
"System" as an entity. This means a table in the database named System, a
class System, a web form System, etc.

Since System is such a reserved word, how should we do this? To rename it
"CableSystem" would bug as isn't consistent/what is desired (should have to
change our business terminology because conflicts with development tool).
For the class, it could be named "System" and just wrapper a namespace
around it named "Classes". But for the web form, while it could be named
System.aspx, you can't just wrap a namespace around it.

System isn't a reserved word - it's just a prominent namespace. It's
likely to be a bit of a pain working with System as the name of a
class, but it should be doable. What problems are you having?
 
R

Ronald S. Cook

Well, the web form inherits from System.Web... so even if I wrap it in a
namespace, that doesn't fly.
 
J

Jon Skeet [C# MVP]

Ronald S. Cook said:
Well, the web form inherits from System.Web... so even if I wrap it in a
namespace, that doesn't fly.

Without an example of where it's actually stopping you, it's hard to
help much more, I'm afraid.
 
R

Ronald S. Cook

Ok, the below won't fly and I don't want to rename all my (form) classes to,
like, "SystemForm" or "frmSystem". Thanks.

System.aspx
-------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Forms
{
public partial class System : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Classes.System System = new Classes.System();
Response.Write(System.SelectSystem());
}
}
}
 
M

mpetrotta

Ok, the below won't fly and I don't want to rename all my (form) classes to,
like, "SystemForm" or "frmSystem". Thanks.

System.aspx
-------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Forms
{
public partial class System : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Classes.System System = new Classes.System();
Response.Write(System.SelectSystem());
}

}
}

.... which fails to compile because:
"The type name 'Web' does not exist in the type
'WebApplication1.System'"

One solution is to qualify all references to the "standard" System
namespace:

public partial class System : global::System.Web.UI.Page

Michael
 
R

Ronald S. Cook

Ooh... good idea! I'll try..thx

... which fails to compile because:
"The type name 'Web' does not exist in the type
'WebApplication1.System'"

One solution is to qualify all references to the "standard" System
namespace:

public partial class System : global::System.Web.UI.Page

Michael
 
R

Ronald S. Cook

Hmm.. that doesn't seem to help.


... which fails to compile because:
"The type name 'Web' does not exist in the type
'WebApplication1.System'"

One solution is to qualify all references to the "standard" System
namespace:

public partial class System : global::System.Web.UI.Page

Michael
 
R

Ronald S. Cook

Heck, .NET renames the class for Default.aspx to _Default so I guess I could
do that (i.e. _System). I'm just big on having a standard that is used
everywhere (and not just for conflicting names).
 
R

Ronald S. Cook

I created System.aspx. In code behind, I added "global::" in front of
System.Web.UI.Page and still got a ton of errors. All of the "using
System.Whatever" statements at the top balk refering to the wrong "System".
Other places too.

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class System : global::System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

}
 
J

Jon Skeet [C# MVP]

Ronald S. Cook said:
I created System.aspx. In code behind, I added "global::" in front of
System.Web.UI.Page and still got a ton of errors. All of the "using
System.Whatever" statements at the top balk refering to the wrong "System".
Other places too.

Put the type in a namespace (as your previous code sample had) and it
compiles fine.
 
R

Ronald S. Cook

It's weird. When I do that (code below), I still get these 3 errors:

Error 1 The type name 'Web' does not exist in the type
'Westinis.Reminde.Forms.System'
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\westinis.reminde.client\322f9295\acfb6d8\App_Web_u06cz-po.0.cs 15

Error 2 The type name 'Web' does not exist in the type
'Westinis.Reminde.Forms.System'
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\westinis.reminde.client\322f9295\acfb6d8\App_Web_u06cz-po.0.cs 17

Error 3 The type name 'Web' does not exist in the type
'Westinis.Reminde.Forms.System'
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\westinis.reminde.client\322f9295\acfb6d8\App_Web_u06cz-po.0.cs 23

Here's the code:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Westinis.Reminde.Forms
{
public partial class System : global::System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
}
 
J

Jon Skeet [C# MVP]

Ronald S. Cook said:
It's weird. When I do that (code below), I still get these 3 errors:

Odd. Where do lines 15, 17 and 23 fall in your code? Because pasting
your code directly into into a text editor, there are only 22 lines as
far as I can see...
 
R

Ronald S. Cook

Yeah, it's referencing some sort of behind-the-scenes temp file. Each time
I rebuild (and get the same 3 errors), the name of that file it references
changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top