As you know, Elanat content management system is based on CodeBehind framework and created under .NET Core. We at Elanat team want to release the new version of Elanat CMS; Elanat CMS version 2.2 will release with the latest version of the CodeBehind framework.
The CodeBehind framework is a powerful alternative to Razor Pages and the default MVC in ASP.NET Core; CodeBehind works up to 40% faster than them and has unique features.
Currently version 2.4.3 is the latest version of the CodeBehind framework. .NET developers are requested to check the latest version of the CodeBehind framework and report any undiscovered issues to us at Elanat.
Only view example
View section: aspx page (razor syntax)
@page
@{
Random rand = new Random();
}
<div>
<h1>Random value: @rand.Next(1000000)</h1>
</div>
View section: aspx page (standard syntax)
<%@ Page %>
<%
Random rand = new Random();
%>
<div>
<h1>Random value: <%=rand.Next(1000000)%></h1>
</div>
MVC example
View File: Default.aspx (razor syntax)
@page
@controller YourProjectName.DefaultController
@model YourProjectName.DefaultModel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@model.PageTitle</title>
</head>
<body>
@model.BodyValue
</body>
</html>
View File: Default.aspx (standard syntax)
<%@ Page Controller="YourProjectName.DefaultController" Model="YourProjectName.DefaultModel" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><%=model.PageTitle%></title>
</head>
<body>
<%=model.BodyValue%>
</body>
</html>
Model File: Default.aspx.Model.cs
using CodeBehind;
namespace YourProjectName
{
public partial class DefaultModel : CodeBehindModel
{
public string PageTitle { get; set; }
public string BodyValue { get; set; }
}
}
Controler File: Default.aspx.Controller.cs
using CodeBehind;
namespace YourProjectName
{
public partial class DefaultController : CodeBehindController
{
public DefaultModel model = new DefaultModel();
public void PageLoad(HttpContext context)
{
model.PageTitle = "My Title";
model.BodyValue = "HTML Body";
View(model);
}
}
}
CodeBehind Configure in ASP.NET Core
Program File: Program.cs
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
+ SetCodeBehind.CodeBehindCompiler.Initialization();
app.Run(async context =>
{
+ CodeBehind.CodeBehindExecute execute = new CodeBehind.CodeBehindExecute();
+ await context.Response.WriteAsync(execute.Run(context));
});
app.Run();
Documents
Programming
- Simple and structured MVC in CodeBehind
- It is not necessary to follow the MVC pattern
- Load aspx page finally result in another aspx page
- Examples of development
- Send data
- Web part in CodeBehind
- Razor syntax reference for CodeBehind framework
- Standard syntax reference for CodeBehind framework
- Constructor method
- HtmlData classes
- Template
- Transfer template block data in ViewData
- Layout
- Section
- Error handling
- Options
- Namespace and dll for CodeBehind view class
- Error detection
- How to use CodeBehind?
- Route configuration
- Used with Razor Pages and ASP.NET Core MVC
- Modularity in the default mode
- Modularity in the configuration of the controller in the route
API and applied methods
Information
- New features on new versions
- How is the list of views finally made?
- CodeBehind framework data
- MVC architecture in CodeBehind
- Performance test, ASP.NET Core MVC and Razor Pages vs CodeBehind Framework in version 2.2
- Performance test in only view section in version 1.5.2 (ASP.NET Core VS CodeBehind)
- CodeBehind story
- ASP.NET Core VS CodeBehind; why should we use CodeBehind?
- CodeBehind framework vs Code-Behind pattern
Creating high-level systems
- How to create modular systems by CodeBehind framework?
- How to create scheduled task system by CodeBehind framework?
- How to create startup system by CodeBehind framework?
- How to create dynamic middleware system by CodeBehind framework?
Ready project
Related links
CodeBehind on GitHub:
https://github.com/elanatframework/Code_behind
CodeBehind in NuGet:
https://www.nuget.org/packages/CodeBehind/
CodeBehind page:
https://elanat.net/page_content/code_behind
Top comments (0)