简体   繁体   中英

Class Diagram aspx

I am currently bussy with my Class Diagram.

My project has some classes (example: User.cs, Friend.cs, Message.cs).

And I have also some .aspx and .ascx (web user control) files which also have classes, for example: ShowFriends.ascx has a ShowFriends.ascx.cs-class.

What I would like to know is: Do I need to take create a class in my class diagram for the ShowFriends.ascx.cs-class? Or is that not allowed because it's a part of a .ascx file? If I don't do it, I will miss lots of things in my class diagram.

If it is allowed: How I can seperate the Friend.cs with the ShowFriends.ascx.cs file in the class diagram? Because the Friend.cs file has only some attributes in it, and the ShowFriends.ascx.cs file has methods like ShowFriends(). And if I create a relation between User and and Friend.cs and ShowFriends.ascx.cs it looks very weird.

For me it's more logical to have one class called Friend.cs or something with all attributes and methods in it (methods Like ShowFriends()), but I dont have that, because I need to create some methods in the .ascx.cs file because of using Request.QueryString["Username"].

Thanks in advance!

The best practice is to define all your classes in a separate file. If you're concerned about accessing the Request object you can still do that outside of the .ascx -files.

As long as your project references System.Web you can access it like this:

 string user = HttpContext.Current.Request["Username"];

I wouldn't put the ascx.cs files inside the class diagram. In the class diagram you want to define your domain model, not your UI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM