diff --git a/src/Templatemap.cs b/src/Templatemap.cs
index dde1bed..e8a1b4e 100644
--- a/src/Templatemap.cs
+++ b/src/Templatemap.cs
@@ -633,7 +633,7 @@ private static string createMudTdDefinition(string name,IntellisenseObject class
output.Append(" ");
if (property.Type.CodeName.StartsWith("bool", StringComparison.OrdinalIgnoreCase))
{
- output.Append($" x.{property.Name})]\" > \r\n");
+ output.Append($" x.{property.Name})]\" > \r\n");
}
else if (property.Type.CodeName.Equals("System.DateTime", StringComparison.OrdinalIgnoreCase))
{
@@ -678,7 +678,7 @@ private static string createMudFormFieldDefinition(IntellisenseObject classObjec
case "bool":
output.Append($" \r\n");
output.Append(" ");
- output.Append($" x.{property.Name})]\" @bind-Checked=\"_model.{property.Name}\" For=\"@(() => _model.{property.Name})\" >\r\n");
+ output.Append($" x.{property.Name})]\" @bind-Value=\"_model.{property.Name}\" For=\"@(() => _model.{property.Name})\" >\r\n");
output.Append(" ");
output.Append($" \r\n");
break;
diff --git a/src/Templates/Caching/.cachekey.cs.txt b/src/Templates/Caching/.cachekey.cs.txt
index 63c172e..0650fb0 100644
--- a/src/Templates/Caching/.cachekey.cs.txt
+++ b/src/Templates/Caching/.cachekey.cs.txt
@@ -15,6 +15,8 @@
// mechanism to refresh cached data in a thread-safe manner.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
namespace {namespace};
///
diff --git a/src/Templates/Commands/AddEdit/.cs.txt b/src/Templates/Commands/AddEdit/.cs.txt
index 9ed3da0..b00ad79 100644
--- a/src/Templates/Commands/AddEdit/.cs.txt
+++ b/src/Templates/Commands/AddEdit/.cs.txt
@@ -8,8 +8,8 @@
// Documentation: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage: Use this command to add or edit a {itemnamelowercase}. Caching and domain event handling are automatic.
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Commands/AddEdit/.validator.cs.txt b/src/Templates/Commands/AddEdit/.validator.cs.txt
index d5e2346..91b6645 100644
--- a/src/Templates/Commands/AddEdit/.validator.cs.txt
+++ b/src/Templates/Commands/AddEdit/.validator.cs.txt
@@ -7,9 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage:
-// Validates AddEdit{itemname}Command constraints (e.g., maximum field lengths).
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Commands/Create/.cs.txt b/src/Templates/Commands/Create/.cs.txt
index a60f22b..38e86fb 100644
--- a/src/Templates/Commands/Create/.cs.txt
+++ b/src/Templates/Commands/Create/.cs.txt
@@ -8,10 +8,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage:
-// Use this command to create a new {itemnamelowercase} with required fields and automatic domain event handling.
-
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Commands/Create/.validator.cs.txt b/src/Templates/Commands/Create/.validator.cs.txt
index 438acda..04e158e 100644
--- a/src/Templates/Commands/Create/.validator.cs.txt
+++ b/src/Templates/Commands/Create/.validator.cs.txt
@@ -7,10 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage:
-// Validates Create{itemname}Command ensuring constraints (e.g., non-empty Name field) before execution.
-
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Commands/Delete/.cs.txt b/src/Templates/Commands/Delete/.cs.txt
index 9693408..2747dec 100644
--- a/src/Templates/Commands/Delete/.cs.txt
+++ b/src/Templates/Commands/Delete/.cs.txt
@@ -8,18 +8,14 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage:
-// Delete multiple {nameofPlural} by specifying their IDs.
-// Domain events are raised for each deletion to support cache invalidation.
-
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.Caching;
-
namespace {namespace};
-public class Delete{itemname}Command: ICacheInvalidatorRequest>
+public class Delete{itemname}Command: ICacheInvalidatorRequest
{
public int[] Id { get; }
public string CacheKey => {itemname}CacheKey.GetAllCacheKey;
@@ -31,7 +27,7 @@ public class Delete{itemname}Command: ICacheInvalidatorRequest>
}
public class Delete{itemname}CommandHandler :
- IRequestHandler>
+ IRequestHandler
{
private readonly IApplicationDbContext _context;
@@ -40,7 +36,7 @@ public class Delete{itemname}CommandHandler :
{
_context = context;
}
- public async Task> Handle(Delete{itemname}Command request, CancellationToken cancellationToken)
+ public async Task Handle(Delete{itemname}Command request, CancellationToken cancellationToken)
{
var items = await _context.{nameofPlural}.Where(x=>request.Id.Contains(x.Id)).ToListAsync(cancellationToken);
foreach (var item in items)
@@ -49,8 +45,8 @@ public class Delete{itemname}CommandHandler :
item.AddDomainEvent(new {itemname}DeletedEvent(item));
_context.{nameofPlural}.Remove(item);
}
- var result = await _context.SaveChangesAsync(cancellationToken);
- return await Result.SuccessAsync(result);
+ await _context.SaveChangesAsync(cancellationToken);
+ return await Result.SuccessAsync();
}
}
diff --git a/src/Templates/Commands/Delete/.validator.cs.txt b/src/Templates/Commands/Delete/.validator.cs.txt
index a412aed..fb37591 100644
--- a/src/Templates/Commands/Delete/.validator.cs.txt
+++ b/src/Templates/Commands/Delete/.validator.cs.txt
@@ -7,10 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-
-// Usage:
-// Validates Delete{itemname}Command by checking that the ID list is non-null and all IDs are > 0.
-
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Commands/Import/.cs.txt b/src/Templates/Commands/Import/.cs.txt
index 09f8378..5fa35c9 100644
--- a/src/Templates/Commands/Import/.cs.txt
+++ b/src/Templates/Commands/Import/.cs.txt
@@ -8,11 +8,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-//
-// Usage:
-// - Use `Import{itemname}sCommand` to import {itemnamelowercase}s from Excel.
-// - Use `Create{itemname}sTemplateCommand` to generate an Excel template for {itemnamelowercase} data.
-
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Commands/Import/.validator.cs.txt b/src/Templates/Commands/Import/.validator.cs.txt
index 685357a..a5382de 100644
--- a/src/Templates/Commands/Import/.validator.cs.txt
+++ b/src/Templates/Commands/Import/.validator.cs.txt
@@ -7,10 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-//
-// Usage:
-// Validates Import{itemname}sCommand to ensure valid data before import.
-
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Commands/Update/.cs.txt b/src/Templates/Commands/Update/.cs.txt
index f233d7f..ddbd1bd 100644
--- a/src/Templates/Commands/Update/.cs.txt
+++ b/src/Templates/Commands/Update/.cs.txt
@@ -7,9 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-//
-// Usage:
-// Use Update{itemname}Command to update an existing {itemnamelowercase}. If found, changes are applied, cache is invalidated, and {itemname}UpdatedEvent is raised.
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Commands/Update/.validator.cs.txt b/src/Templates/Commands/Update/.validator.cs.txt
index 9930c84..37d41a2 100644
--- a/src/Templates/Commands/Update/.validator.cs.txt
+++ b/src/Templates/Commands/Update/.validator.cs.txt
@@ -7,10 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-//
-// Usage:
-// Validates Update{itemname}Command to ensure complete and valid data before processing the update.
-
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/DTOs/.dto.cs.txt b/src/Templates/DTOs/.dto.cs.txt
index cbadc37..207e60b 100644
--- a/src/Templates/DTOs/.dto.cs.txt
+++ b/src/Templates/DTOs/.dto.cs.txt
@@ -7,9 +7,8 @@
// Docs: https://docs.cleanarchitectureblazor.com/features/{itemnamelowercase}
//
//------------------------------------------------------------------------------
-//
-// Usage:
-// Use {itemname}Dto to represent {itemnamelowercase} data across commands, queries, and views.
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Pages/.create.razor.txt b/src/Templates/Pages/.create.razor.txt
index fc210d1..b408074 100644
--- a/src/Templates/Pages/.create.razor.txt
+++ b/src/Templates/Pages/.create.razor.txt
@@ -33,16 +33,17 @@
public string? Title { get; private set; }
MudForm? _{itemnamelowercase}Form;
private bool _saving = false;
- private List _breadcrumbItems = new List
- {
- new BreadcrumbItem("Home", href: "/"),
- new BreadcrumbItem("{nameofPlural}", href: "/pages/{nameofplurallowercase}"),
- new BreadcrumbItem("Create {itemname}", href:null, disabled:true)
- };
+ private List? _breadcrumbItems;
private Create{itemname}Command _model = new();
protected override Task OnInitializedAsync()
{
- Title = L["Create {itemname}"];
+ Title = L["New {itemname}"];
+ _breadcrumbItems = new List
+ {
+ new BreadcrumbItem(L["Home"], href: "/"),
+ new BreadcrumbItem(L["{nameofPlural}"], href: "/pages/{nameofplurallowercase}"),
+ new BreadcrumbItem(L["Create {itemname}"], href:null, disabled:true)
+ };
return Task.CompletedTask;
}
async Task OnSubmit()
diff --git a/src/Templates/Pages/.edit.razor.txt b/src/Templates/Pages/.edit.razor.txt
index 536ebfb..1fb70fa 100644
--- a/src/Templates/Pages/.edit.razor.txt
+++ b/src/Templates/Pages/.edit.razor.txt
@@ -41,15 +41,16 @@
public int Id { get; set; }
MudForm? _{itemnamelowercase}Form;
private bool _saving = false;
- private List _breadcrumbItems = new List
- {
- new BreadcrumbItem("Home", href: "/"),
- new BreadcrumbItem("{nameofPlural}", href: "/pages/{nameofplurallowercase}")
- };
+ private List? _breadcrumbItems;
private Update{itemname}Command? _model;
protected override async Task OnInitializedAsync()
{
Title = L["Edit {itemname}"];
+ _breadcrumbItems = new List
+ {
+ new BreadcrumbItem(L["Home"], href: "/"),
+ new BreadcrumbItem(L["{nameofPlural}"], href: "/pages/{nameofplurallowercase}")
+ };
var result = await Mediator.Send(new Get{itemname}ByIdQuery() { Id = Id });
result.Map(data =>
{
diff --git a/src/Templates/Pages/.view.razor.txt b/src/Templates/Pages/.view.razor.txt
index cb95de8..9e960fd 100644
--- a/src/Templates/Pages/.view.razor.txt
+++ b/src/Templates/Pages/.view.razor.txt
@@ -31,15 +31,16 @@
public string? Title { get; private set; }
[Parameter]
public int Id { get; set; }
- private List _breadcrumbItems = new List
- {
- new BreadcrumbItem("Home", href: "/"),
- new BreadcrumbItem("{nameofPlural}", href: "/pages/{nameofplurallowercase}")
- };
+ private List? _breadcrumbItems;
private {itemname}Dto? _model;
protected override async Task OnInitializedAsync()
{
Title = L["{itemname}"];
+ _breadcrumbItems = new List
+ {
+ new BreadcrumbItem(L["Home"], href: "/"),
+ new BreadcrumbItem(L["{nameofPlural}"], href: "/pages/{nameofplurallowercase}")
+ };
var result = await Mediator.Send(new Get{itemname}ByIdQuery() { Id = Id });
result.Map(data =>
{
diff --git a/src/Templates/Queries/Export/.cs.txt b/src/Templates/Queries/Export/.cs.txt
index 67704c3..d900725 100644
--- a/src/Templates/Queries/Export/.cs.txt
+++ b/src/Templates/Queries/Export/.cs.txt
@@ -13,6 +13,8 @@
// the specified {itemnamelowercase} details.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Queries/GetAll/.cs.txt b/src/Templates/Queries/GetAll/.cs.txt
index 4266313..fef6d10 100644
--- a/src/Templates/Queries/GetAll/.cs.txt
+++ b/src/Templates/Queries/GetAll/.cs.txt
@@ -13,6 +13,8 @@
// queries.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Queries/GetById/.cs.txt b/src/Templates/Queries/GetById/.cs.txt
index 87003ad..96aaa2e 100644
--- a/src/Templates/Queries/GetById/.cs.txt
+++ b/src/Templates/Queries/GetById/.cs.txt
@@ -12,6 +12,8 @@
// to optimize performance for repeated retrievals of the same {itemnamelowercase}.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Queries/Pagination/.cs.txt b/src/Templates/Queries/Pagination/.cs.txt
index d194b9c..c749f87 100644
--- a/src/Templates/Queries/Pagination/.cs.txt
+++ b/src/Templates/Queries/Pagination/.cs.txt
@@ -12,6 +12,8 @@
// options. The result is cached to enhance performance for repeated queries.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
using {selectns}.{nameofPlural}.DTOs;
using {selectns}.{nameofPlural}.Caching;
diff --git a/src/Templates/Specifications/AdvancedFilter.cs.txt b/src/Templates/Specifications/AdvancedFilter.cs.txt
index 3ad03c6..a40a396 100644
--- a/src/Templates/Specifications/AdvancedFilter.cs.txt
+++ b/src/Templates/Specifications/AdvancedFilter.cs.txt
@@ -13,6 +13,8 @@
// filters such as view types and user-specific filters.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
namespace {namespace};
diff --git a/src/Templates/Specifications/AdvancedSpecification.cs.txt b/src/Templates/Specifications/AdvancedSpecification.cs.txt
index b0ce06c..105af5d 100644
--- a/src/Templates/Specifications/AdvancedSpecification.cs.txt
+++ b/src/Templates/Specifications/AdvancedSpecification.cs.txt
@@ -12,6 +12,8 @@
// {itemname} entity, supporting different views and keyword-based searches.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
namespace {namespace};
#nullable disable warnings
diff --git a/src/Templates/Specifications/ByIdSpecification.cs.txt b/src/Templates/Specifications/ByIdSpecification.cs.txt
index 15397c9..217e17d 100644
--- a/src/Templates/Specifications/ByIdSpecification.cs.txt
+++ b/src/Templates/Specifications/ByIdSpecification.cs.txt
@@ -11,6 +11,8 @@
// Defines a specification for filtering a {itemname} entity by its ID.
//
//------------------------------------------------------------------------------
+#nullable enable
+#nullable disable warnings
namespace {namespace};
#nullable disable warnings