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()
public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder .UseRGF() .UseStartup<Startup>(); }); }
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 RGF\DBModel könyvtárba
public void ConfigureServices(IServiceCollection services) { ... //saját DbContext esetén => services.AddDbContext<YourDbContext>(...); BaseDbContext.AddDbContext(services); ... services.AddControllersWithViews(); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { ... //saját DbContext esetén => app.UseRGF<YourDbContext>(); app.UseRGF<BaseDbContext, BaseDbContextPool, BaseDbContextPool>(); ... app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
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"
}
}
}
PostgreSQL használata esetén telepíteni kell
Oracle használata esetén telepíteni kell