Gestalt.Core
1.0.29
See the version list below for details.
dotnet add package Gestalt.Core --version 1.0.29
NuGet\Install-Package Gestalt.Core -Version 1.0.29
<PackageReference Include="Gestalt.Core" Version="1.0.29" />
paket add Gestalt.Core --version 1.0.29
#r "nuget: Gestalt.Core, 1.0.29"
// Install Gestalt.Core as a Cake Addin #addin nuget:?package=Gestalt.Core&version=1.0.29 // Install Gestalt.Core as a Cake Tool #tool nuget:?package=Gestalt.Core&version=1.0.29
<img src="https://jacraig.github.io/Gestalt/images/Icon.png" style="height:25px" alt="Gestalt Icon" /> Gestalt
Gestalt is a C# library designed to facilitate the development of modular applications. It allows developers to create reusable modules that can be easily integrated into various applications, enhancing code reusability and maintainability.
Table of Contents
Introduction
Modern software development often requires building applications with modular architectures to promote reusability and scalability. Gestalt provides a framework for organizing application functionality into cohesive modules, encapsulating logic and services that can be easily shared across different projects.
Features
- Modular Architecture: Define modules encapsulating configuration, services, and lifecycle events.
- Configuration Management: Easily configure application settings using built-in configuration providers.
- Dependency Injection: Utilize dependency injection for managing dependencies and services.
- Lifecycle Management: Implement lifecycle events such as application start, stop, and shutdown.
Getting Started
Installation
Gestalt can be installed via NuGet Package Manager:
dotnet add package Gestalt.Core
Or for framework specific functionality, install the appropriate package:
# For ASP.NET base functionality
dotnet add package Gestalt.AspNet
# For ASP.NET MVC functionality
dotnet add package Gestalt.AspNet.MVC
# For ASP.NET Controllers functionality (without views)
dotnet add package Gestalt.AspNet.Controllers
# For ASP.NET SignalR functionality
dotnet add package Gestalt.AspNet.SignalR
# For ASP.NET Razor Pages functionality
dotnet add package Gestalt.AspNet.RazorPages
# For console applications
dotnet add package Gestalt.Console
Creating Modules
To create a module, follow these steps:
Define a class that inherits from one of the *ModuleBaseClasses or implements one of the IApplicationModule interfaces (IMvcModule, ISignalRModule, IRazorPagesModule, etc).
Override methods for configuring settings, services, and lifecycle events.
Implement module-specific functionality within the class.
A basic example of a module class is shown below:
/// <summary>
/// This is an example of a basic module that configures the application with the usual default settings when creating a new web application.
/// It implements the MvcModuleBaseClass which simplifies the process of creating a module that needs to modify MVC settings.
/// However, you can implement the IMvcModule interface directly if you prefer.
/// </summary>
public class BasicModule : MvcModuleBaseClass<BasicModule>
{
/// <summary>
/// This is called to configure the IApplicationBuilder object. Since this is an MVC app, that would be the WebApplication object.
/// </summary>
/// <param name="applicationBuilder">The application builder object.</param>
/// <param name="configuration">The configuration object.</param>
/// <param name="environment">The host environment object.</param>
/// <returns>The application builder object should be returned.</returns>
public override IApplicationBuilder? ConfigureApplication(IApplicationBuilder? applicationBuilder, IConfiguration? configuration, IHostEnvironment? environment)
{
if (applicationBuilder is null)
return applicationBuilder;
// Configure the HTTP request pipeline.
if (environment?.IsDevelopment() == false)
{
// This is the default exception handler for the application when in production.
_ = applicationBuilder.UseExceptionHandler("/Home/Error");
// We will add a strict transport security header to the response.
_ = applicationBuilder.UseHsts();
}
// This will redirect HTTP requests to HTTPS.
_ = applicationBuilder.UseHttpsRedirection();
// And let's serve static files.
_ = applicationBuilder.UseStaticFiles();
// We will also add authorization to the application.
_ = applicationBuilder.UseAuthorization();
// And lastly, we will return the application builder.
return applicationBuilder;
}
/// <summary>
/// This is called to configure the MVC options. We will just return the options object as is.
/// </summary>
/// <param name="mVCBuilder">The MVC builder object.</param>
/// <param name="configuration">The configuration object.</param>
/// <param name="environment">The host environment object.</param>
/// <returns>The MVC builder object.</returns>
public override IMvcBuilder? ConfigureMVC(IMvcBuilder? mVCBuilder, IConfiguration? configuration, IHostEnvironment? environment)
{
return mVCBuilder;
}
/// <summary>
/// This is called to configure our endpoint routes. For our example, we will just use the default route.
/// </summary>
/// <param name="endpoints">The endpoint route builder.</param>
/// <param name="configuration">The configuration object.</param>
/// <param name="environment">The host environment object.</param>
/// <returns>The endpoint route builder.</returns>
public override IEndpointRouteBuilder? ConfigureRoutes(IEndpointRouteBuilder? endpoints, IConfiguration? configuration, IHostEnvironment? environment)
{
if (endpoints is null)
return endpoints;
// Map the default route.
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
return endpoints;
}
}
Using Modules
To have your application start using modules, you just need to call UseGestalt on the application builder:
// Program.cs
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var app = builder.UseGestalt<ExampleModule>();
app.Run();
}
}
For more advanced usage, refer to the documentation.
Contributing
Contributions to Gestalt are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request. Before contributing, please review the contribution guidelines.
License
Gestalt is licensed under the Apache 2.0 License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- BigBook (>= 5.1.50)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
-
net8.0
- BigBook (>= 5.1.50)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Gestalt.Core:
Package | Downloads |
---|---|
Gestalt.ASPNet
This is the ASP.Net specific implementation of Gestalt. Gestalt is a comprehensive ASP.NET application framework designed to streamline the development and packaging process with its modular architecture. With Gestalt, effortlessly construct robust ASP.NET applications using modular design principles and leverage the power of dependency injection for seamless integration of reusable components. Incorporate plugins effortlessly, configuring them via a flexible configuration system. Gestalt empowers developers to craft scalable and maintainable applications, focusing on building reusable modules and extensions. Whether you're developing a small-scale project or a large enterprise application, Gestalt provides the foundation for modular, extensible ASP.NET solutions. |
|
Gestalt.ASPNet.RazorPages
This adds the razor pages framework specific functionality to Gestalt. Gestalt is a comprehensive application framework designed to streamline the development and packaging process with its modular architecture. With Gestalt, effortlessly construct robust applications using modular design principles and leverage the power of dependency injection for seamless integration of reusable components. Incorporate plugins effortlessly, configuring them via a flexible configuration system. Gestalt empowers developers to craft scalable and maintainable applications, focusing on building reusable modules and extensions. Whether you're developing a small-scale project or a large enterprise application, Gestalt provides the foundation for modular, extensible solutions. |
|
Gestalt.ASPNet.SignalR
This adds the SignalR framework specific functionality to Gestalt. Gestalt is a comprehensive application framework designed to streamline the development and packaging process with its modular architecture. With Gestalt, effortlessly construct robust applications using modular design principles and leverage the power of dependency injection for seamless integration of reusable components. Incorporate plugins effortlessly, configuring them via a flexible configuration system. Gestalt empowers developers to craft scalable and maintainable applications, focusing on building reusable modules and extensions. Whether you're developing a small-scale project or a large enterprise application, Gestalt provides the foundation for modular, extensible solutions. |
|
Gestalt.Console
This is the console specific implementation of Gestalt. Gestalt is a comprehensive application framework designed to streamline the development and packaging process with its modular architecture. With Gestalt, effortlessly construct robust applications using modular design principles and leverage the power of dependency injection for seamless integration of reusable components. Incorporate plugins effortlessly, configuring them via a flexible configuration system. Gestalt empowers developers to craft scalable and maintainable applications, focusing on building reusable modules and extensions. Whether you're developing a small-scale project or a large enterprise application, Gestalt provides the foundation for modular, extensible solutions. |
|
Gestalt.ASPNet.MVC
This adds the MVC framework specific functionality to Gestalt. Gestalt is a comprehensive application framework designed to streamline the development and packaging process with its modular architecture. With Gestalt, effortlessly construct robust applications using modular design principles and leverage the power of dependency injection for seamless integration of reusable components. Incorporate plugins effortlessly, configuring them via a flexible configuration system. Gestalt empowers developers to craft scalable and maintainable applications, focusing on building reusable modules and extensions. Whether you're developing a small-scale project or a large enterprise application, Gestalt provides the foundation for modular, extensible solutions. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.38 | 37 | 10/31/2024 |
1.0.37 | 104 | 10/29/2024 |
1.0.36 | 151 | 10/29/2024 |
1.0.35 | 160 | 10/10/2024 |
1.0.34 | 154 | 10/9/2024 |
1.0.33 | 156 | 10/8/2024 |
1.0.32 | 201 | 8/28/2024 |
1.0.31 | 201 | 8/26/2024 |
1.0.30 | 224 | 8/23/2024 |
1.0.29 | 226 | 8/21/2024 |
1.0.28 | 221 | 8/15/2024 |
1.0.27 | 151 | 8/3/2024 |
1.0.26 | 143 | 7/24/2024 |
1.0.25 | 198 | 7/10/2024 |
1.0.24 | 205 | 6/26/2024 |
1.0.23 | 203 | 6/25/2024 |
1.0.22 | 212 | 6/18/2024 |
1.0.21 | 229 | 6/18/2024 |
1.0.20 | 210 | 6/14/2024 |
1.0.19 | 199 | 6/12/2024 |
1.0.18 | 192 | 5/30/2024 |
1.0.17 | 206 | 5/30/2024 |
1.0.16 | 202 | 5/17/2024 |
1.0.15 | 220 | 5/16/2024 |
1.0.14 | 224 | 5/7/2024 |
1.0.13 | 226 | 5/6/2024 |
1.0.12 | 199 | 5/2/2024 |
1.0.11 | 208 | 5/1/2024 |
1.0.10 | 215 | 5/1/2024 |
1.0.9 | 220 | 4/29/2024 |
1.0.8 | 234 | 4/12/2024 |
1.0.7 | 222 | 4/11/2024 |
1.0.6 | 222 | 3/30/2024 |
1.0.5 | 208 | 3/28/2024 |
1.0.4 | 230 | 3/26/2024 |
1.0.3 | 212 | 3/26/2024 |
1.0.2 | 229 | 3/26/2024 |
1.0.1 | 202 | 3/22/2024 |
1.0.0 | 117 | 3/13/2024 |