-
-
Notifications
You must be signed in to change notification settings - Fork 220
Core Platform
Huy Nguyen edited this page Apr 5, 2025
·
2 revisions
The Core Platform is the foundation of Mixcore CMS, providing essential services and infrastructure for all applications. This document details the core components and their functionality.
The Authentication Service handles user authentication and session management:
public interface IAuthenticationService
{
Task<AuthenticationResult> AuthenticateAsync(string username, string password);
Task<AuthenticationResult> RefreshTokenAsync(string refreshToken);
Task<bool> ValidateTokenAsync(string token);
}{
"Authentication": {
"Jwt": {
"Issuer": "mixcore",
"Audience": "mixcore-clients",
"SecretKey": "your-secret-key",
"ExpiryInMinutes": 60
}
}
}The Authorization Service manages access control and permissions:
public interface IAuthorizationService
{
Task<bool> HasPermissionAsync(string userId, string permission);
Task<IEnumerable<string>> GetUserRolesAsync(string userId);
Task<bool> IsInRoleAsync(string userId, string role);
}module:action:resource
example: content:edit:page
The Data Access Service provides a unified interface for database operations:
public interface IRepository<T> where T : class
{
Task<T> GetByIdAsync(int id);
Task<IEnumerable<T>> GetAllAsync();
Task<T> AddAsync(T entity);
Task UpdateAsync(T entity);
Task DeleteAsync(T entity);
}{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=mixcore;Trusted_Connection=True;"
},
"DataAccess": {
"UseCache": true,
"CacheDuration": 300,
"BatchSize": 100
}
}The Module System automatically discovers and loads modules:
public interface IModule
{
string Name { get; }
string Version { get; }
void ConfigureServices(IServiceCollection services);
void Configure(IApplicationBuilder app);
}public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMixcoreModules();
}
}Modules can declare dependencies on other modules:
[ModuleDependency(typeof(OtherModule))]
public class MyModule : IModule
{
// Module implementation
}The Service Container manages service registration and resolution:
public interface IServiceContainer
{
void Register<TService, TImplementation>(ServiceLifetime lifetime);
TService Resolve<TService>();
object Resolve(Type serviceType);
}public class Module : IModule
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IMyService, MyService>();
services.AddTransient<IMyOtherService, MyOtherService>();
services.AddSingleton<IMySingletonService, MySingletonService>();
}
}The Configuration Provider manages application settings:
public interface IConfigurationProvider
{
T GetValue<T>(string key);
T GetSection<T>(string section);
void Reload();
}public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
}
}The Event Bus facilitates event-driven architecture:
public interface IEventBus
{
void Subscribe<TEvent>(IEventHandler<TEvent> handler);
void Publish<TEvent>(TEvent @event);
void Unsubscribe<TEvent>(IEventHandler<TEvent> handler);
}public class MyEventHandler : IEventHandler<MyEvent>
{
public Task HandleAsync(MyEvent @event)
{
// Handle the event
return Task.CompletedTask;
}
}The Logger provides centralized logging:
public interface ILogger
{
void Log(LogLevel level, string message, Exception exception = null);
void LogInformation(string message);
void LogWarning(string message);
void LogError(string message, Exception exception = null);
}{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"System": "Warning"
},
"File": {
"Path": "logs/mixcore-{Date}.log",
"RetentionDays": 7
}
}
}- Visit our Community Forum
- Check the Troubleshooting Guide
- Contact Support for enterprise assistance