Skip to content

Commit b77e07a

Browse files
committed
custom solution file, new desharp release, routes updates
1 parent 0c8c547 commit b77e07a

File tree

9 files changed

+274
-76
lines changed

9 files changed

+274
-76
lines changed

App_Start/RouteConfig.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ public static void RegisterRoutes (RouteCollection routes) {
1313

1414
routes.MapRoute(
1515
name: "Index",
16-
url: "",
16+
url: "Index",
1717
defaults: new { controller = "Index", action = "Index", something = UrlParameter.Optional },
1818
constraints: new {
1919
something = @"\d*"
2020
}
2121
);
2222
routes.MapRoute(
2323
name: "Submit",
24-
url: "submit",
24+
url: "Index/Submit",
2525
defaults: new { controller = "Index", action = "Submit" }
2626
);
2727
routes.MapRoute(
2828
name: "Done",
29-
url: "done",
29+
url: "Index/Done",
3030
defaults: new { controller = "Index", action = "Done" }
3131
);
3232

@@ -137,10 +137,17 @@ public static void RegisterRoutes (RouteCollection routes) {
137137
routes.MapRoute(
138138
name: "contact",
139139
url: "contact",
140-
defaults: new { controller = "Home", action = "Contact", productId = 0 },
141-
constraints: new {
142-
productId = @"\d+"
143-
}
140+
defaults: new { controller = "Home", action = "Contact" }
141+
);
142+
routes.MapRoute(
143+
name: "about",
144+
url: "about",
145+
defaults: new { controller = "Home", action = "About" }
146+
);
147+
routes.MapRoute(
148+
name: "home",
149+
url: "",
150+
defaults: new { controller = "Home", action = "Index" }
144151
);
145152

146153

Controllers/HomeController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
namespace ExampleWebMVC.Controllers {
88
public class HomeController: Controller {
99
public ActionResult Index () {
10+
Desharp.Debug.Dump(this.Request.Url.AbsoluteUri);
1011
return View();
1112
}
1213

1314
public ActionResult About () {
1415
ViewBag.Message = "Your application description page.";
15-
16+
Desharp.Debug.Dump(this.Request.Url.AbsoluteUri);
1617
return View();
1718
}
1819

1920
public ActionResult Contact (int productId = -1) {
2021
ViewBag.Message = "Your contact page.";
21-
22+
Desharp.Debug.Dump(this.Request.Url.AbsoluteUri);
2223
return View();
2324
}
2425
}

Controllers/IndexController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace ExampleWebMVC.Controllers {
88
public class IndexController: Controller {
99
public ActionResult Index () {
1010

11+
Desharp.Debug.Dump(this.Request.Url.AbsoluteUri);
1112
//this._runSimulatedException();
1213

1314
this.Session["list"] = new List<string>() { "a", "b", "c" };

Desharp.config.example

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
4+
<startup>
5+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
6+
</startup>
7+
8+
9+
<!-- For web applications only - add Desharp http module by: -->
10+
<system.webServer>
11+
<modules>
12+
<add name="Desharp" type="Desharp.Module" preCondition="managedHandler" />
13+
</modules>
14+
<httpErrors errorMode="Detailed" />
15+
</system.webServer>
16+
17+
18+
<appSettings>
19+
20+
<!--
21+
If `true`, all dumps by method `Debug.Dump()` are internally rendered and displayed.
22+
For web applications, there is debug panel is displayed in browser with dumped variables or rendered exceptions.
23+
For desktop applications, there is console priniting enabled or output debug window printing enabled.
24+
- Not required to configure, but very recomanded.
25+
- Possible values: `1`, `0`, `true`, `false`.
26+
- If not configured - enabled is only when VS debugger is attached or entry assembly is builded as Debug.
27+
- If disabled - all `Debug.Log()` calls are still enabled and executed, see more option `Desharp:Levels`.
28+
-->
29+
<add key="Desharp:Enabled" value="1" />
30+
31+
<!--
32+
Logs content format.
33+
- Not required, `text` by default.
34+
- Possible values: `html`, `text`.
35+
-->
36+
<add key="Desharp:Output" value="html" />
37+
38+
<!--
39+
Client IP adresses list to limit `Desharp` enabled state only for some clients.
40+
- Not required to configure, very recomanded for web applications.
41+
- Possible values: IPv4 or IPv6, separated by comma (IPv6 without `[]` brackets).
42+
- If not configured and `Desharp` is in enabled state, then `Desharp` is enabled for all clients.
43+
-->
44+
<add key="Desharp:DebugIps" value="127.0.0.1,::1" />
45+
46+
<!--
47+
Loggin levels to enable/disable to write on hard drive and also possibility to enable/disable email notifications.
48+
- Not required, recomanded.
49+
- Possible values: `exception`, `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency`, `javascript`.
50+
- If not configured, all logging levels are enabled for logging and not enabled for email notifications.
51+
- If at least one level is configured, then all other configured levels are disabled for logging and for email notifications.
52+
- If you want to enable any logging level - put the level name into node `value` attribute (comma separated).
53+
- If you want to disable any logging level - put minus (-) character before level name or remove level name.
54+
- If you want to enable any logging level for email notifications - put plus (+) character before level name.
55+
For any notification type with plus sign, it required to configure `Desharp:NotifySettings` property!
56+
-->
57+
<add key="Desharp:Levels" value="+exception,debug,info,-notice,-warning,+error,+critical,alert,+emergency,javascript" />
58+
59+
<!--
60+
Logged messages notifications by configured levels.
61+
- Not required, recomanded in production mode.
62+
- Possible values:
63+
- `host`: Required, mail server smtp domain | IPv4 | IPv6.
64+
- `port`: Not required, `25` by default.
65+
- `ssl`: Not required, `false` by default.
66+
- `from`: Required if no username and password specified, email address to specify sender, if no value specified, there is used `username` value.
67+
- `username` and `password`: Required if no `from` sender specified, mail server username/password credentials for sender account, always necessary to use together.
68+
- `domain` - Not required, no default value. Used only as third parametter for `System.Net.NetworkCredential` if presented.
69+
- `to`: Required, single recepient email adress or multiple adresses separated by semicolon `;`.
70+
- `priority`: Not required, possible values: `low` | `normal` | `high` (`normal` by defaut).
71+
- `timeout`: Not required, smtp server timeout specified in miliseconds, `10000` by default (10 seconds).
72+
- `background`: Not required at all. Default value is `true` to send all notifications in background thread.
73+
Use `false` value only to debug email sending.
74+
-->
75+
<add key="Desharp:NotifySettings" value="{
76+
host: 'smtp.company.com',
77+
port: 587,
78+
ssl: true,
79+
user: 'noreply@company.com',
80+
password: 'your-secret-password',
81+
from: 'noreply@company.com',
82+
to: 'your.name@gmail.com',
83+
priority: 'high',
84+
timeout: 30000
85+
}" />
86+
87+
<!--
88+
Web debug bar panels.
89+
- Not required, recomanded.
90+
- Full class names separated by comma `,`.
91+
- Panel class has to implement public interface: `Desharp.Panels.IPanel`
92+
- Panel class could implement interface: `Desharp.Panels.ISessionPanel`,
93+
where are method called when session is is read and written every request.
94+
- There are always enabled build-in panels for execution time, dumps and exceptions.
95+
- Build-in panels you can optionally use:
96+
- `Desharp.Panels.SystemInfo` - to display most important request info
97+
- `Desharp.Panels.Session` - to display basic session configuration and values
98+
- `Desharp.Panels.Routing` - to display matched MVC routes (still in TODO state)
99+
-->
100+
<add key="Desharp:Panels" value="Desharp.Panels.SystemInfo,Desharp.Panels.Session" />
101+
102+
<!--
103+
Absolute or relative path from application root directory.
104+
- Not required, recomanded.
105+
- Relative path from app root has to start with '~/' like: '~/Path/To/Logs'.
106+
- If not configured, all log files are written into application root directory.
107+
-->
108+
<add key="Desharp:Directory" value="~/Logs" />
109+
110+
<!--
111+
Always render source location from where dump has been called by `Debug.Dump()`.
112+
- Not required, recomanded.
113+
- Possible values: `1`, `0`, `true`, `false`.
114+
- If not configured, no dumps source locations are rendered in dump ouputs.
115+
-->
116+
<add key="Desharp:SourceLocation" value="1" />
117+
118+
<!--
119+
Milisecond timeout how often logged messages or exceptions are written from memory to hard drive.
120+
- Not required, recomanded for speed optimalization in production mode.
121+
- Possible values - use digits to define any miliseconds integer value.
122+
- If not configured, all messages or exceptions are written immediately
123+
in current thread, where is called `Desharp.Log()`.
124+
-->
125+
<add key="Desharp:WriteMiliseconds" value="5000" />
126+
127+
<!--
128+
.NET objects dumping depth.
129+
- Not required, recomanded for speed optimalization in production mode.
130+
- Possible values: just digit like `2`, `3`, `4` or `5`.
131+
- If not configured, `3` by default.
132+
-->
133+
<add key="Desharp:Depth" value="3" />
134+
135+
<!--
136+
Maximum length for dumped string values.
137+
- Not required, recomanded for speed optimalization in production mode.
138+
- Possible values: just digit like `512`, `1024` or `5000`...
139+
- If not configured, `1024` by default.
140+
-->
141+
<add key="Desharp:MaxLength" value="1024" />
142+
143+
<!--
144+
Custom web error page.
145+
- Not required, recomanded for production mode.
146+
- If `Desharp` is not enabled and there is uncaught exception in your application,
147+
you can use custom static error page to transfer into client browser.
148+
- If not configured - `Desharp` build-in error page is used by default with error 500.
149+
-->
150+
<add key="Desharp:ErrorPage" value="~/custom-error-page-500.html" />
151+
152+
<!--
153+
Dump all internal .NET events, properties ad fields in custom class instances,
154+
(created internally and usually for properties values )and all class instance
155+
member types marked with `System.Runtime.CompilerServices.CompillerGenerated`
156+
attribute or with `Desharp.Hidden` attribute.
157+
This option is usefull to see everything in memory.
158+
- Not required, recomanded only for deep development view.
159+
- Possible values: `1`, `0`, `true`, `false`.
160+
- If not configured, `false` by default.
161+
- If not configured or configured as `false`, you can hide
162+
your class members for dumping and logging by attributes:
163+
- [System.Runtime.CompilerServices.CompilerGenerated] - .NET standard.
164+
- [Desharp.Hidden] - shorter.
165+
-->
166+
<add key="Desharp:DumpCompillerGenerated" value="true" />
167+
168+
<!--
169+
Default editor param value.
170+
- Not required, marginal.
171+
- For automatic file opening in Visual Studio or in any other editor by rendered links:
172+
`<a href="editor://file=...&line=...&editor=MSVS2019">../File.cs:123</a>
173+
- Possible values: any string key to open your editor from html output by.
174+
- If not configured, value is automaticly detected by Visual Studio instalation on current system.
175+
-->
176+
<add key="Desharp:Editor" value="MSVS2019" />
177+
178+
</appSettings>
179+
</configuration>

ExampleWebMVC.csproj

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
4-
<Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
5-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
63
<PropertyGroup>
74
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
85
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -45,12 +42,12 @@
4542
<WarningLevel>4</WarningLevel>
4643
</PropertyGroup>
4744
<ItemGroup>
48-
<Reference Include="Desharp, Version=1.3.0.0, Culture=neutral, PublicKeyToken=cd60d985c52bcd6f, processorArchitecture=MSIL">
49-
<HintPath>..\packages\Desharp.1.3.0\lib\net40\Desharp.dll</HintPath>
45+
<Reference Include="Desharp">
46+
<HintPath>packages\Desharp.1.3.0.2\lib\net40\Desharp.dll</HintPath>
5047
<Private>True</Private>
5148
</Reference>
5249
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53-
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
50+
<HintPath>.\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
5451
<Private>True</Private>
5552
</Reference>
5653
<Reference Include="Microsoft.CSharp" />
@@ -75,54 +72,54 @@
7572
<Reference Include="System.EnterpriseServices" />
7673
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7774
<Private>True</Private>
78-
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
75+
<HintPath>.\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
7976
</Reference>
8077
<Reference Include="System.Net.Http">
8178
</Reference>
8279
<Reference Include="System.Net.Http.WebRequest">
8380
</Reference>
8481
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8582
<Private>True</Private>
86-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
83+
<HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
8784
</Reference>
8885
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8986
<Private>True</Private>
90-
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
87+
<HintPath>.\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
9188
</Reference>
9289
<Reference Include="System.Web.Optimization">
93-
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
90+
<HintPath>.\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
9491
</Reference>
9592
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9693
<Private>True</Private>
97-
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
94+
<HintPath>.\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
9895
</Reference>
9996
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
10097
<Private>True</Private>
101-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
98+
<HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
10299
</Reference>
103100
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
104101
<Private>True</Private>
105-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
102+
<HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
106103
</Reference>
107104
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
108105
<Private>True</Private>
109-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
106+
<HintPath>.\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
110107
</Reference>
111108
<Reference Include="WebGrease">
112109
<Private>True</Private>
113-
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
110+
<HintPath>.\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
114111
</Reference>
115112
<Reference Include="Antlr3.Runtime">
116113
<Private>True</Private>
117-
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
114+
<HintPath>.\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
118115
</Reference>
119116
</ItemGroup>
120117
<ItemGroup>
121118
<Reference Include="Newtonsoft.Json">
122-
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
119+
<HintPath>.\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
123120
</Reference>
124121
<Reference Include="Microsoft.AspNet.Identity.Core">
125-
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
122+
<HintPath>.\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
126123
</Reference>
127124
</ItemGroup>
128125
<ItemGroup>
@@ -145,6 +142,7 @@
145142
<Content Include="Content\Site.css" />
146143
<Content Include="Scripts\bootstrap.js" />
147144
<Content Include="Scripts\bootstrap.min.js" />
145+
<Content Include="Desharp.config.example" />
148146
<None Include="Scripts\jquery-1.10.2.intellisense.js" />
149147
<Content Include="Scripts\jquery-1.10.2.js" />
150148
<Content Include="Scripts\jquery-1.10.2.min.js" />
@@ -222,8 +220,6 @@
222220
<PropertyGroup>
223221
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
224222
</PropertyGroup>
225-
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
226-
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
227223
</Target>
228224
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
229225
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)