Telepítés / Inicializálás |
This topic contains the following sections:
A RecroGrid Framework használatához a projekthez hozzá kell adni a https://www.nuget.org/packages/RecroGrid/ csomagot.
Package Manager: Install-Package RecroGrid .NET CLI: dotnet add package RecroGrid |
webBuilder kiterjesztése RGF használathoz -> UseRGF()
Az adatbázis inicializáláshoz létre kell hozni egy DbContext-et, illetve az első fordításánál az RGF generál az Area\RGF\DBModel könyvtárba
var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllersWithViews(); // Setup RGF for Dependency injection builder.WebHost.UseRGF(); //Initialize DbContext for RGF. //If you don't have own DbContext, then RGF generates default DbContext during the first build into RGF\DBModel folder. //builder.Services.AddDbContext<YourDbContext>(...); //or if you use RGF default DbContext BaseDbContext.AddDbContext(builder.Services); var app = builder.Build(); // Configure the HTTP request pipeline. app.UseStaticFiles(); app.UseRouting(); //app.UseRGF<YourDbContext>(); //or if you use RGF default DbContext app.UseRGF<BaseDbContext, BaseDbContextPool, BaseDbContextPool>(); app.MapControllers(); app.Run();
A projekt inicializálása után azt elindítva, az RGF adminisztrátori felületén engedélyezni kell a működéshez szükséges adatbázis táblák létrehozását. Az adminisztrátori felület az alkalmazás /RGF/Admin útvonalán érhető el.
Opcionális menü kiegészítés MVC alkalmazásban
<head> ... <link rel="stylesheet" href="/rgf/resource/bootstrap-submenu.css" /> </head> <body> ... @*add class: rgf-menu*@ <ul class="navbar-nav flex-grow-1 rgf-menu"> <li> ... </li> @Html.Raw(Recrovit.RecroGridFramework.UI.MenuDesigner.CreateNavbar(this.Context)) </ul> ... @Html.Raw(Recrovit.RecroGridFramework.RecroGrid.GetRecroGridScriptReferences(this.Context)) @RenderSection("Scripts", required: false) </body>
Alapértelmezett beállítások az appsettings.json-ban.
Ha a DefaultConnectionName nem definiált, akkor a DefaultConnection nevűt veszi, ha nincs olyan, akkor az elsőt.
{
"ConnectionStrings": {
"SQLServer": "Server=(localdb)\\mssqllocaldb;Database=RGFDemo;Trusted_Connection=True;MultipleActiveResultSets=true",
//"SQLServer": "Server=(localdb)\\mssqllocaldb;AttachDBFilename=%CONTENTROOTPATH%\\App_Data\\RGFDemo.mdf;Database=RGFDemo;Trusted_Connection=true;MultipleActiveResultSets=true",
//"SQLServer": "Server=.\\SQLExpress;Database=RGFDemo;Trusted_Connection=True;MultipleActiveResultSets=true",
//"SQLServer": "Server=SQLServer2019.lan,1433;Database=RGFDemo;User ID=rgf;Password=psw;MultipleActiveResultSets=true",
"PostgreSQL": "Host=PostgreSQL.lan;Database=RGFDemo;Username=rgf;Password=psw;Command Timeout=15",
"Oracle12": "Data Source=Oracle12c.lan:1521/ora12;User Id=C##RGF;Password=psw"
},
"Recrovit": {
"RecroGrid": {
//"DefaultMenuScope": "",
"DefaultConnectionName": "SQLServer",
//"DefaultConnectionName": "PostgreSQL",
//"DefaultConnectionName": "Oracle12",
//"DefaultSchema": "",
//"ItemsPerPage": 15,
"SQLTimeout": 15,
//"StylesPath": "rgf/styles",
"jQueryUIThemeName": "base"
},
"RecroSec": {
"Enabled": true, //true eseten minden objektumot paraméterezni kell, egyébként az entitásban lehet jelezni, hogy RecroSec kell
"SingleUserMode": true,
"AdministratorGroupName": "Administrators",
//"RoleScope": "test",
"CacheMode": "Process", //Process, RGCache, Disable
"AnonymousId": "Anonymous"
},
"RecroDict": {
"DefaultLanguage": "hun"
},
"RecroTrack": {
"Enabled": true,
"RowVersionName": "rowversion"//case sensitive
}
}
}
PostgreSQL használata esetén telepíteni kell
Oracle használata esetén telepíteni kell