Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to better snippet syntax #33048

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define MULT2 // DEFAULT RR RH DB DF DF2 UFS UFS2 TREE FECTP NS MUL MULT2
#if NEVER
#elif DEFAULT
#region snippet
// <snippet>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand All @@ -24,9 +24,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet>
#elif RR
#region snippet_rr
// <snippet_rr>
using Microsoft.Extensions.FileProviders;

var builder = WebApplication.CreateBuilder(args);
Expand Down Expand Up @@ -57,9 +57,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_rr>
#elif RH
#region snippet_rh
// <snippet_rh>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand Down Expand Up @@ -91,9 +91,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_rh>
#elif DB // Directory Browsing
#region snippet_db
// <snippet_db>
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;

Expand Down Expand Up @@ -138,9 +138,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_db>
#elif DF // Default file
#region snippet_df
// <snippet_df>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand All @@ -165,9 +165,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_df>
#elif DF2
#region snippet_df2
// <snippet_df2>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand Down Expand Up @@ -196,9 +196,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_df2>
#elif UFS
#region snippet_ufs
// <snippet_ufs>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand All @@ -222,9 +222,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_ufs>
#elif UFS2
#region snippet_ufs2
// <snippet_ufs2>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand Down Expand Up @@ -252,9 +252,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_ufs2>
#elif TREE
#region snippet_tree
// <snippet_tree>
using Microsoft.Extensions.FileProviders;

var builder = WebApplication.CreateBuilder(args);
Expand Down Expand Up @@ -290,9 +290,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_tree>
#elif FECTP
#region snippet_fec
// <snippet_fec>
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.FileProviders;

Expand Down Expand Up @@ -333,9 +333,9 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_fec>
#elif NS
#region snippet_ns
// <snippet_ns>
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
Expand Down Expand Up @@ -363,7 +363,7 @@
app.MapRazorPages();

app.Run();
#endregion
// </snippet_ns>
#elif MUL
using Microsoft.Extensions.FileProviders;

Expand All @@ -382,14 +382,14 @@

app.UseHttpsRedirection();

#region snippet_mul
// <snippet_mul>
app.UseStaticFiles(); // Serve files from wwwroot
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "MyStaticFiles"))
});
#endregion
// </snippet_mul>

app.UseAuthorization();

Expand All @@ -415,7 +415,7 @@

app.UseHttpsRedirection();

#region snippet_mult2
// <snippet_mult2>
var webRootProvider = new PhysicalFileProvider(builder.Environment.WebRootPath);
var newPathProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "MyStaticFiles"));
Expand All @@ -428,7 +428,7 @@

app.UseStaticFiles();

#endregion
// </snippet_mult2>

app.UseAuthorization();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define FIRST // FIRST
#if NEVER
#elif FIRST
#region snippet1
// <snippet1>
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
Args = args,
Expand All @@ -15,9 +15,9 @@
app.UseStaticFiles();

app.Run();
#endregion
// </snippet1>
#elif SECOND
#region snippet2
// <snippet2>
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
{
Args = args,
Expand All @@ -38,5 +38,5 @@
app.UseStaticFiles();

app.Run();
#endregion
// </snippet2>
#endif
Loading