Overview
- Razor Pages project using .NET 8 and the M# (MSharp) framework.
- Purpose: sample registration flow with domain model
Registerand UI form modules. The project includes custom code in thePangolinfolder (your Pangolin code). - Key feature added: automatic
InvitationCodegeneration for newRegisterrecords.
Requirements
- .NET 8 SDK
- Visual Studio 2022 (or later) or the
dotnetCLI - M# runtime / packages used by the project (refer to the solution's NuGet packages)
Quick start (CLI)
- Clone the repository:
git clone https://github.com/bamdadtabari-geeksltd/GeeksLtdMsharp
- Restore and build:
dotnet restoredotnet build
- Run (if the web project is the startup project):
dotnet run --project <path-to-web-project>
Or open the solution in Visual Studio and use the IDE to run.
Quick start (Visual Studio)
- Open the solution in Visual Studio 2022.
- Select the web project as the startup project.
- Use Build > Build Solution then Debug > Start Debugging (or Start Without Debugging).
Project layout (important files)
M#\Model\Domain\Register.cs— M# model definition for theRegisterentity.Domain\Logic\Register.cs— partial domain logic (validation + InvitationCode generation).Domain\[GEN-Entities]\Register.cs— generated entity class (auto-generated).M#\UI\Modules\Register\RegisterForm.cs— M# form module for registration UI.M#\UI\Pages\RegisterPage.cs— page that hosts the form module.Website\Controllers\Pages\Register.Controller.cs— controller + viewmodel glue for posting the form.Pangolin/— your custom Pangolin code (see notes below).
M# documentation
- Primary project and API docs / code samples: https://github.com/Geeksltd/MSharp
(Refer to the M# repo and its documentation for framework specifics: model DSL, modules, pages, and code generation.) - Use M# docs when modifying
EntityTypedeclarations,.Calculated()fields, UIFormModule<T>and module life-cycle hooks.
Pangolin folder
- The repository contains a
Pangolinfolder with your Pangolins code. This folder appears to hold custom utilities / components you wrote. - Recommended:
- Add a
Pangolin/README.mddescribing the purpose and how to build/run those components. - If Pangolin contains a library used by the web app, ensure its project is referenced by the main solution and listed in the solution file.
- If Pangolin is a standalone tool, document required inputs, outputs and example usages.
- Add a
InvitationCode behavior (what's implemented)
- New
Registerinstances get an automatically-generated invitation code at construction time (secure random alphanumeric, avoids ambiguous characters). - Current model uses
.Calculated()forInvitationCode(read-only calculated property). That means:- The code is generated in the domain constructor and is available at runtime.
- It is not persisted in the database by default because generated entities mark it as calculated.
- To persist the generated invitation code:
- Change the M# model to remove
.Calculated()forInvitationCode(useString("InvitationCode")instead). - Regenerate or update the generated entity so EF maps the column, then run migrations or update the database.
- Consider enforcing uniqueness if required.
- Change the M# model to remove
Notes & troubleshooting
- If you see validation messages related to email or age, those are enforced in
Domain\Logic\Register.cs. - If you need the UI to display the generated invitation code to the user after save, persist the code (see previous section) or expose it via the ViewModel.
- For NuGet and package issues, use Tools > NuGet Package Manager > Manage NuGet Packages for Solution or the
dotnetCLI (dotnet restore,dotnet nuget).
Contributing
- Fork -> branch -> PR.
- Keep changes scoped (one feature / fix per PR).
- Add unit tests for domain logic where possible.
Contact / author
- Repository origin:
https://github.com/bamdadtabari-geeksltd/GeeksLtdMsharp(branch:master). - If you want, I can:
- Persist
InvitationCodeand add a migration. - Add a
Pangolin/README.mdwith concrete build/run steps if you tell me what's inside the folder. - Add tests for the
Registervalidation and InvitationCode generation.
- Persist
License
- Add your preferred license file (
LICENSE) in the repo root if needed.