├── QuickCore.png ├── Quick.Core.App.pas ├── Quick.Core.Mvc.pas ├── QuickMVCCore.png ├── docs ├── QuickCore.png └── githubstartme.jpg ├── Quick.Core.Entity.pas ├── Quick.Core.Identity.pas ├── Quick.Core.Logging.pas ├── Quick.Core.AutoMapper.pas ├── Quick.Core.Container.pas ├── Quick.Core.Entity.DAO.pas ├── Quick.Core.Mvc.WebApi.pas ├── expert ├── CoreMvcExpert.res ├── CoreMvc.Template.Controller.txt ├── CoreMvc.Template.Controller.Example.txt ├── CoreMvcExpert.dpk ├── CoreMvc.Template.Project.txt ├── CoreMvc.Template.Startup.txt ├── CoreMvc.StartupCreator.pas ├── CoreMvc.ControllerCreator.pas ├── CoreMvc.Wizards.pas ├── CoreMvc.ProjectCreator.pas ├── CoreMvc.Wizard.MainForm.pas ├── CoreMvc.Wizards.Utils.pas └── CoreMvc.Wizard.MainForm.dfm ├── Quick.Core.Commandline.pas ├── Quick.Core.Entity.Config.pas ├── Quick.Core.Entity.Query.pas ├── Quick.Core.MessageQueue.pas ├── Quick.Core.Mvc.Context.pas ├── Quick.Core.Mvc.Routing.pas ├── Quick.Core.Mvc.Session.pas ├── Quick.Core.Serialization.pas ├── Quick.Core.TaskControl.pas ├── Quick.Core.Entity.Database.pas ├── Quick.Core.Entity.Request.pas ├── Quick.Core.Mvc.Controller.pas ├── Quick.Core.Mvc.Middleware.pas ├── Quick.Core.Security.Claims.pas ├── Quick.Core.Entity.Engine.ADO.pas ├── Quick.Core.Extensions.Entity.pas ├── Quick.Core.Extensions.Hosting.pas ├── Quick.Core.Extensions.Service.pas ├── Quick.Core.Linq.Abstractions.pas ├── Quick.Core.Mvc.ActionInvoker.pas ├── Quick.Core.Mvc.ActionResult.pas ├── Quick.Core.Mvc.Middleware.MVC.pas ├── Quick.Core.Mvc.ViewFeatures.pas ├── Quick.Core.Serialization.Json.pas ├── Quick.Core.Serialization.Yaml.pas ├── Quick.Core.Caching.Abstractions.pas ├── Quick.Core.Logging.Abstractions.pas ├── Quick.Core.Mapping.Abstractions.pas ├── Quick.Core.Mvc.Middleware.Cache.pas ├── Quick.Core.Mvc.Middleware.Hsts.pas ├── Quick.Core.Security.UserManager.pas ├── Quick.Core.Entity.Engine.FireDAC.pas ├── Quick.Core.Entity.Factory.Database.pas ├── Quick.Core.Extensions.AutoMapper.pas ├── Quick.Core.Extensions.HealthChecks.pas ├── Quick.Core.Extensions.Localization.pas ├── Quick.Core.Identity.Store.Entity.pas ├── Quick.Core.Mvc.Extensions.Service.pas ├── Quick.Core.Mvc.Factory.Controller.pas ├── Quick.Core.Mvc.Middleware.Routing.pas ├── Quick.Core.Mvc.ViewEngine.Mustache.pas ├── Quick.Core.Security.Authentication.pas ├── Quick.Core.Security.Authorization.pas ├── Quick.Core.Entity.Engine.RestServer.pas ├── Quick.Core.Extensions.Authentication.pas ├── Quick.Core.Extensions.Authorization.pas ├── Quick.Core.Extensions.Caching.Memory.pas ├── Quick.Core.Extensions.Caching.Redis.pas ├── Quick.Core.Extensions.Serialization.pas ├── Quick.Core.Extensions.Service.Linux.pas ├── Quick.Core.Localization.Abstractions.pas ├── Quick.Core.MessageQueue.Abstractions.pas ├── Quick.Core.Mvc.Middleware.LogRequest.pas ├── Quick.Core.Entity.QueryGenerator.MSSQL.pas ├── Quick.Core.Entity.QueryGenerator.MySQL.pas ├── Quick.Core.Entity.QueryGenerator.SQLite.pas ├── Quick.Core.Extensions.Service.Windows.pas ├── Quick.Core.Identity.Store.Abstractions.pas ├── Quick.Core.Mvc.Extensions.Entity.Rest.pas ├── Quick.Core.Mvc.Extensions.HealthChecks.pas ├── Quick.Core.Mvc.Extensions.TaskControl.pas ├── Quick.Core.Mvc.Middleware.Authorization.pas ├── Quick.Core.Mvc.Middleware.StaticFiles.pas ├── Quick.Core.Serialization.Abstractions.pas ├── Quick.Core.Entity.Factory.QueryGenerator.pas ├── Quick.Core.Entity.QueryGenerator.MSAccess.pas ├── Quick.Core.Extensions.HealthChecks.Entity.pas ├── Quick.Core.Extensions.HealthChecks.Redis.pas ├── Quick.Core.Extensions.MessageQueue.Redis.pas ├── Quick.Core.Mvc.Extensions.ResponseCaching.pas ├── Quick.Core.Mvc.Middleware.Authentication.pas ├── Quick.Core.Extensions.Authentication.ApiKey.pas ├── Quick.Core.Extensions.HealthChecks.SqlServer.pas ├── Quick.Core.Mvc.Middleware.HttpsRedirection.pas ├── samples └── delphi │ ├── SimpleController │ ├── SimpleServer.res │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ └── QuickLogger.yml │ ├── controllers │ │ └── Controller.Home.pas │ ├── Startup.pas │ └── SimpleServer.dpr │ ├── MessageQueue │ ├── ServerRedisMessageQueue.res │ ├── PingTask.pas │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ ├── appSettings.yml │ │ │ └── QuickLogger.yml │ ├── ServerRedisMessageQueue.dpr │ ├── controllers │ │ └── Controller.Home.pas │ └── Startup.pas │ ├── TaskControlServer │ ├── TaskControlServer.res │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ ├── appSettings.json │ │ │ ├── wwwroot │ │ │ ├── error.css │ │ │ ├── error.html │ │ │ └── index.html │ │ │ └── QuickLogger.yml │ ├── TaskControlServer.Config.App.pas │ ├── TaskControlServer.Controller.Home.pas │ ├── TaskControlServer.dpr │ └── Startup.pas │ ├── ApiKeyDatabaseStore │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ ├── shop.db │ │ │ └── appSettings.yml │ ├── ServerApiKeyDatabaseStore.res │ ├── infrastructure │ │ ├── Infra.Data.Models.Product.pas │ │ ├── Infra.Data.DBContext.Shop.pas │ │ ├── Identities │ │ │ └── Infra.Data.Identities.pas │ │ └── Infra.Data.Models.Costumer.pas │ ├── controllers │ │ ├── Controller.Home.pas │ │ └── Controller.Products.pas │ ├── ServerApiKeyDatabaseStore.dpr │ └── Startup.pas │ ├── ResponseCaching │ ├── ServerResponseCaching.res │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ └── QuickLogger.yml │ ├── controllers │ │ └── Controller.Home.pas │ ├── Startup.pas │ └── ServerResponseCaching.dpr │ ├── ApiKeyMemoryStore │ ├── ServerApiKeyMemoryStore.res │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ ├── appSettings.yml │ │ │ └── QuickLogger.yml │ ├── controllers │ │ └── Controller.Home.pas │ ├── ServerApiKeyMemoryStore.dpr │ └── Startup.pas │ ├── DistributedCaching │ ├── ServerDistributedCaching.res │ ├── bin │ │ └── Win64 │ │ │ └── Debug │ │ │ └── QuickLogger.yml │ ├── controllers │ │ └── Controller.Home.pas │ ├── ServerDistributedCaching.dpr │ └── Startup.pas │ └── RestClient-Server │ └── Server │ └── RestServer.dpr ├── Delphinus.Install.json ├── Delphinus.Info.json ├── Quick.Core.Extensions.FormFactory.pas ├── .gitignore ├── Quick.Core.Extensions.Service.Abstractions.pas ├── QuickCore.inc ├── LICENSE ├── LICENSE.txt └── README.md /QuickCore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/QuickCore.png -------------------------------------------------------------------------------- /Quick.Core.App.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.App.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.pas -------------------------------------------------------------------------------- /QuickMVCCore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/QuickMVCCore.png -------------------------------------------------------------------------------- /docs/QuickCore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/docs/QuickCore.png -------------------------------------------------------------------------------- /Quick.Core.Entity.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.pas -------------------------------------------------------------------------------- /Quick.Core.Identity.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Identity.pas -------------------------------------------------------------------------------- /Quick.Core.Logging.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Logging.pas -------------------------------------------------------------------------------- /docs/githubstartme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/docs/githubstartme.jpg -------------------------------------------------------------------------------- /Quick.Core.AutoMapper.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.AutoMapper.pas -------------------------------------------------------------------------------- /Quick.Core.Container.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Container.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.DAO.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.DAO.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.WebApi.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.WebApi.pas -------------------------------------------------------------------------------- /expert/CoreMvcExpert.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/expert/CoreMvcExpert.res -------------------------------------------------------------------------------- /Quick.Core.Commandline.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Commandline.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Config.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Config.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Query.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Query.pas -------------------------------------------------------------------------------- /Quick.Core.MessageQueue.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.MessageQueue.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Context.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Context.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Routing.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Routing.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Session.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Session.pas -------------------------------------------------------------------------------- /Quick.Core.Serialization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Serialization.pas -------------------------------------------------------------------------------- /Quick.Core.TaskControl.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.TaskControl.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Database.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Database.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Request.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Request.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Controller.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Controller.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.pas -------------------------------------------------------------------------------- /Quick.Core.Security.Claims.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Security.Claims.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Engine.ADO.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Engine.ADO.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Entity.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Entity.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Hosting.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Hosting.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Service.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Service.pas -------------------------------------------------------------------------------- /Quick.Core.Linq.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Linq.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.ActionInvoker.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.ActionInvoker.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.ActionResult.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.ActionResult.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.MVC.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.MVC.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.ViewFeatures.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.ViewFeatures.pas -------------------------------------------------------------------------------- /Quick.Core.Serialization.Json.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Serialization.Json.pas -------------------------------------------------------------------------------- /Quick.Core.Serialization.Yaml.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Serialization.Yaml.pas -------------------------------------------------------------------------------- /Quick.Core.Caching.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Caching.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Logging.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Logging.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Mapping.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mapping.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.Cache.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.Cache.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.Hsts.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.Hsts.pas -------------------------------------------------------------------------------- /Quick.Core.Security.UserManager.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Security.UserManager.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Engine.FireDAC.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Engine.FireDAC.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Factory.Database.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Factory.Database.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.AutoMapper.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.AutoMapper.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.HealthChecks.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.HealthChecks.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Localization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Localization.pas -------------------------------------------------------------------------------- /Quick.Core.Identity.Store.Entity.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Identity.Store.Entity.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Extensions.Service.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Extensions.Service.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Factory.Controller.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Factory.Controller.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.Routing.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.Routing.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.ViewEngine.Mustache.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.ViewEngine.Mustache.pas -------------------------------------------------------------------------------- /Quick.Core.Security.Authentication.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Security.Authentication.pas -------------------------------------------------------------------------------- /Quick.Core.Security.Authorization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Security.Authorization.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Engine.RestServer.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Engine.RestServer.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Authentication.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Authentication.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Authorization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Authorization.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Caching.Memory.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Caching.Memory.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Caching.Redis.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Caching.Redis.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Serialization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Serialization.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Service.Linux.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Service.Linux.pas -------------------------------------------------------------------------------- /Quick.Core.Localization.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Localization.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.MessageQueue.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.MessageQueue.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.LogRequest.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.LogRequest.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.QueryGenerator.MSSQL.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.QueryGenerator.MSSQL.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.QueryGenerator.MySQL.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.QueryGenerator.MySQL.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.QueryGenerator.SQLite.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.QueryGenerator.SQLite.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Service.Windows.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Service.Windows.pas -------------------------------------------------------------------------------- /Quick.Core.Identity.Store.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Identity.Store.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Extensions.Entity.Rest.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Extensions.Entity.Rest.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Extensions.HealthChecks.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Extensions.HealthChecks.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Extensions.TaskControl.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Extensions.TaskControl.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.Authorization.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.Authorization.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.StaticFiles.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.StaticFiles.pas -------------------------------------------------------------------------------- /Quick.Core.Serialization.Abstractions.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Serialization.Abstractions.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.Factory.QueryGenerator.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.Factory.QueryGenerator.pas -------------------------------------------------------------------------------- /Quick.Core.Entity.QueryGenerator.MSAccess.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Entity.QueryGenerator.MSAccess.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.HealthChecks.Entity.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.HealthChecks.Entity.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.HealthChecks.Redis.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.HealthChecks.Redis.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.MessageQueue.Redis.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.MessageQueue.Redis.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Extensions.ResponseCaching.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Extensions.ResponseCaching.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.Authentication.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.Authentication.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.Authentication.ApiKey.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.Authentication.ApiKey.pas -------------------------------------------------------------------------------- /Quick.Core.Extensions.HealthChecks.SqlServer.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Extensions.HealthChecks.SqlServer.pas -------------------------------------------------------------------------------- /Quick.Core.Mvc.Middleware.HttpsRedirection.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/Quick.Core.Mvc.Middleware.HttpsRedirection.pas -------------------------------------------------------------------------------- /samples/delphi/SimpleController/SimpleServer.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/SimpleController/SimpleServer.res -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/ServerRedisMessageQueue.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/MessageQueue/ServerRedisMessageQueue.res -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/TaskControlServer.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/TaskControlServer/TaskControlServer.res -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/bin/Win64/Debug/shop.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/ApiKeyDatabaseStore/bin/Win64/Debug/shop.db -------------------------------------------------------------------------------- /samples/delphi/ResponseCaching/ServerResponseCaching.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/ResponseCaching/ServerResponseCaching.res -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/ServerApiKeyMemoryStore.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/ApiKeyMemoryStore/ServerApiKeyMemoryStore.res -------------------------------------------------------------------------------- /samples/delphi/DistributedCaching/ServerDistributedCaching.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/DistributedCaching/ServerDistributedCaching.res -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/ServerApiKeyDatabaseStore.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exilon/QuickCore/HEAD/samples/delphi/ApiKeyDatabaseStore/ServerApiKeyDatabaseStore.res -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/bin/Win64/Debug/appSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "Connections": [] 4 | }, 5 | "AppSettings": { 6 | "Smtp": "mail.domain.com", 7 | "Email": "info@domain.com" 8 | }, 9 | "TaskControl": { 10 | "ConcurrentWorkers": 20 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/PingTask.pas: -------------------------------------------------------------------------------- 1 | unit PingTask; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils; 7 | 8 | type 9 | TPingTask = class 10 | private 11 | fId : string; 12 | fHost : string; 13 | public 14 | property Id : string read fId write fId; 15 | property Host : string read fHost write fHost; 16 | end; 17 | 18 | implementation 19 | 20 | end. 21 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/bin/Win64/Debug/wwwroot/error.css: -------------------------------------------------------------------------------- 1 | h4 2 | { 3 | color: rgba(74,134,232,1); 4 | font: normal 27px/1 "Trebuchet MS", Helvetica, sans-serif; 5 | } 6 | 7 | div.box1 8 | { 9 | color: #777777; 10 | border: solid 1px rgba(140,140,140,0.20); 11 | background-color: rgba(180,180,180,0.43); 12 | padding: 14px 20px; 13 | font: normal 16px/1 "Trebuchet MS", Helvetica, sans-serif; 14 | } -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/TaskControlServer.Config.App.pas: -------------------------------------------------------------------------------- 1 | unit TaskControlServer.Config.App; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Options; 7 | 8 | type 9 | TAppSettings = class(TOptions) 10 | private 11 | fSmtp : string; 12 | fEmail : string; 13 | published 14 | property Smtp : string read fSmtp write fSmtp; 15 | property Email : string read fEmail write fEmail; 16 | end; 17 | 18 | implementation 19 | 20 | end. 21 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/bin/Win64/Debug/appSettings.yml: -------------------------------------------------------------------------------- 1 | ApiKey: 2 | UnAuthorizedErrorCode: 401 3 | UnAuthorizedErrorMessage: Not authenticated 4 | ApiKeys: 5 | - Name: John 6 | Role: Admin 7 | Key: fkjsfVMfskdfkaiienvz23k12nfaadfavbkx 8 | Expiration: null 9 | Active: true 10 | 11 | - Name: Peter 12 | Role: User 13 | Key: mmvkasffoasd034jadsfkvnaaj3bfajxcfh 14 | Expiration: null 15 | Active: true 16 | 17 | 18 | -------------------------------------------------------------------------------- /Delphinus.Install.json: -------------------------------------------------------------------------------- 1 | { 2 | "search_pathes": 3 | [ 4 | { 5 | "pathes": ".", 6 | "platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64" 7 | } 8 | ], 9 | "browsing_pathes": 10 | [ 11 | { 12 | "pathes": ".", 13 | "platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64" 14 | } 15 | ], 16 | 17 | "source_folders": 18 | [ 19 | { 20 | "folder": ".", 21 | "recursive": true, 22 | "filter": "*;*.*" 23 | } 24 | ] 25 | 26 | } -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/bin/Win64/Debug/appSettings.yml: -------------------------------------------------------------------------------- 1 | RedisMessageQueue: 2 | Host: klingon 3 | Port: 6379 4 | Database: 2 5 | Key: mailqueue 6 | Password: pass123 7 | ConnectionTimeout: 20000 8 | ReadTimeout: 10000 9 | PopTimeoutSec: 30 10 | MaxProducersPool: 10 11 | MaxConsumersPool: 10 12 | ReliableMessageQueue: 13 | CheckHangedMessagesIntervalSec: 10 14 | DetermineAsHangedAfterSec: 20 15 | RetryFailedMessages: false 16 | RetryFailedMessageEverySec: 0 17 | Enabled: true 18 | RetainDoneMessages: false 19 | 20 | -------------------------------------------------------------------------------- /samples/delphi/DistributedCaching/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | MaxFailsToRestart: 2 3 | MaxFailsToStop: 0 4 | Environment: "" 5 | IncludedInfo: [iiAppName,iiHost] 6 | SendLimits: 7 | TimeRange: slNoLimit 8 | LimitEventTypes: [] 9 | MaxSent: 0 10 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 11 | CustomMsgOutput: False 12 | Enabled: True 13 | ShowEventColors: True 14 | ShowTimeStamp: True 15 | ShowEventType: False 16 | UnderlineHeaderEventType: False 17 | 18 | -------------------------------------------------------------------------------- /samples/delphi/ResponseCaching/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | MaxFailsToRestart: 2 3 | MaxFailsToStop: 0 4 | Environment: "" 5 | IncludedInfo: [iiAppName,iiHost] 6 | SendLimits: 7 | TimeRange: slNoLimit 8 | LimitEventTypes: [] 9 | MaxSent: 0 10 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 11 | CustomMsgOutput: false 12 | Enabled: true 13 | ShowEventColors: true 14 | ShowTimeStamp: true 15 | ShowEventType: false 16 | UnderlineHeaderEventType: false 17 | 18 | -------------------------------------------------------------------------------- /samples/delphi/SimpleController/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | MaxFailsToRestart: 2 3 | MaxFailsToStop: 0 4 | Environment: "" 5 | IncludedInfo: [iiAppName,iiHost] 6 | SendLimits: 7 | TimeRange: slNoLimit 8 | LimitEventTypes: [] 9 | MaxSent: 0 10 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 11 | CustomMsgOutput: False 12 | Enabled: True 13 | ShowEventColors: True 14 | ShowTimeStamp: True 15 | ShowEventType: False 16 | UnderlineHeaderEventType: False 17 | 18 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/infrastructure/Infra.Data.Models.Product.pas: -------------------------------------------------------------------------------- 1 | unit Infra.Data.Models.Product; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Entity; 7 | 8 | type 9 | [Table('Products')] 10 | TDBProduct = class(TEntity) 11 | private 12 | fId : TAutoID; 13 | fName : string; 14 | fPrice : Double; 15 | published 16 | [Key] 17 | property Id : TAutoID read fId write fId; 18 | [StringLength(50)] 19 | property Name : string read fName write fName; 20 | [DecimalLength(10,2)] 21 | property Price : Double read fPrice write fPrice; 22 | end; 23 | 24 | implementation 25 | 26 | end. 27 | -------------------------------------------------------------------------------- /expert/CoreMvc.Template.Controller.txt: -------------------------------------------------------------------------------- 1 | unit {%MODULENAME%} 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | THomeController = class(THttpController) 14 | published 15 | [HttpGet('Home'),ActionName('Index')] 16 | function Index : IActionResult; 17 | end; 18 | 19 | implementation 20 | 21 | { THomeController } 22 | 23 | function THomeController.Index: IActionResult; 24 | begin 25 | Result := Content('Welcome to Home page!'); 26 | end; 27 | 28 | initialization 29 | RegisterController(THomeController); 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/infrastructure/Infra.Data.DBContext.Shop.pas: -------------------------------------------------------------------------------- 1 | unit Infra.Data.DBContext.Shop; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Entity, 7 | Infra.Data.Models.Product, 8 | Infra.Data.Models.Costumer; 9 | 10 | type 11 | TShopContext = class(TDBContext) 12 | private 13 | fProducts : TDBSet; 14 | fCostumer : TDBSet; 15 | public 16 | [&Index('Name')] 17 | property Products : TDBSet read fProducts write fProducts; 18 | //[&Index(['Last_Name','First_Name'])] 19 | property Costumers : TDBSet read fCostumer write fCostumer; 20 | end; 21 | 22 | implementation 23 | 24 | end. 25 | -------------------------------------------------------------------------------- /expert/CoreMvc.Template.Controller.Example.txt: -------------------------------------------------------------------------------- 1 | unit HomeController; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | THomeController = class(THttpController) 14 | published 15 | [HttpGet('Home'),ActionName('Index')] 16 | function Index : IActionResult; 17 | end; 18 | 19 | implementation 20 | 21 | { THomeController } 22 | 23 | function THomeController.Index: IActionResult; 24 | begin 25 | Result := Content('Welcome to Home page!'); 26 | end; 27 | 28 | initialization 29 | RegisterController(THomeController); 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /samples/delphi/SimpleController/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | THomeController = class(THttpController) 14 | published 15 | [HttpGet('Home'),ActionName('Index')] 16 | function Index : IActionResult; 17 | end; 18 | 19 | implementation 20 | 21 | { THomeController } 22 | 23 | function THomeController.Index: IActionResult; 24 | begin 25 | Result := Content('Welcome to Home page!'); 26 | end; 27 | 28 | initialization 29 | RegisterController(THomeController); 30 | 31 | end. 32 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | [Route('')] 14 | THomeController = class(THttpController) 15 | published 16 | [HttpGet,ActionName('Index')] 17 | function Index : IActionResult; 18 | end; 19 | 20 | implementation 21 | 22 | { THomeController } 23 | 24 | function THomeController.Index: IActionResult; 25 | begin 26 | Result := Content('Use /Product CRUD'); 27 | end; 28 | 29 | initialization 30 | RegisterController(THomeController); 31 | 32 | end. 33 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/bin/Win64/Debug/wwwroot/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 18 |

404 Error: Page not found

19 |
20 | The resource you requested was not found in server. 21 |
22 | 23 | -------------------------------------------------------------------------------- /Delphinus.Info.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "{46860175-E7FE-4919-BA1F-AC759A761FC9}", 3 | "name": "", 4 | "picture": "QuickCore.png", 5 | "license_type": "Apache-2.0", 6 | "license_file": "LICENSE.txt", 7 | "platforms": "Win32;Win64;OSX32;Android;IOSDevice32;IOSDevice64;Linux64", 8 | "package_compiler_min": 22, 9 | "package_compiler_max": 36, 10 | "compiler_min": 22, 11 | "compiler_max": 36, 12 | "first_version": "1.0", 13 | "report_url": "", 14 | "dependencies": 15 | [ 16 | { 17 | "id": "{039708CE-1DC1-4FC5-A58E-A77B3177A9C8}", 18 | "version_min": "1.0" 19 | }, 20 | { 21 | "id": "{A404182F-6CED-4E8A-9028-6E068B5B7074}}", 22 | "version_min": "1.0" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/infrastructure/Identities/Infra.Data.Identities.pas: -------------------------------------------------------------------------------- 1 | unit Infra.Data.Identities; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Entity; 7 | 8 | type 9 | TUser = class(TIdentityUser) 10 | private 11 | fFullName : string; 12 | fEmail : string; 13 | fApiKey : string; 14 | published 15 | [StringLength(100)] 16 | property FulName : string read fFullName write fFullName; 17 | 18 | [StringLength(100)] 19 | property Email : string read fEmail write fEmail; 20 | 21 | [StringLength(50)] 22 | property ApiKey : string read fApiKey write fApiKey; 23 | end; 24 | 25 | TRole = class(TIdentityRole) 26 | private 27 | fDescription : string; 28 | published 29 | [StringLength(255)] 30 | property Description : string read fDescription write fDescription; 31 | end; 32 | 33 | implementation 34 | 35 | end. 36 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | [Route('')] 14 | [Authorize] 15 | THomeController = class(THttpController) 16 | published 17 | [AllowAnonymous] 18 | [HttpGet('Home/Index')] 19 | function Index : IActionResult; 20 | 21 | [HttpGet('Sum/{number1:int}/{number2:int}')] 22 | function Sum(Number1, Number2 : Integer) : IActionResult; 23 | end; 24 | 25 | implementation 26 | 27 | { THomeController } 28 | 29 | function THomeController.Index: IActionResult; 30 | begin 31 | Result := Content('Use /Sum/{number1}/{number2}'); 32 | end; 33 | 34 | function THomeController.Sum(Number1, Number2 : Integer): IActionResult; 35 | begin 36 | Result := Content(Format('Sum(%d + %d) = %d',[Number1,Number2,Number1 + Number2])); 37 | end; 38 | 39 | initialization 40 | RegisterController(THomeController); 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /samples/delphi/DistributedCaching/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | THomeController = class(THttpController) 14 | published 15 | [HttpGet('Home'),ActionName('Index')] 16 | function Index : IActionResult; 17 | 18 | [HttpGet('Test/Random/{number?}'), OutputCache(5000)] 19 | function Random(Number : Integer = 10) : IActionResult; 20 | end; 21 | 22 | implementation 23 | 24 | { THomeController } 25 | 26 | function THomeController.Index: IActionResult; 27 | begin 28 | Result := Content('User /random/{number} return value will be cached for 5 seconds'); 29 | end; 30 | 31 | function THomeController.Random(Number: Integer = 10): IActionResult; 32 | begin 33 | if Number < 1 then Result := StatusCode(THttpStatusCode.BadRequest,'Number too low!') 34 | else Result := Content(Format('Random(%d) = %d (cached for 5s)',[Number,System.Random(Number)])); 35 | end; 36 | 37 | initialization 38 | RegisterController(THomeController); 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /samples/delphi/ResponseCaching/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Commons; 11 | 12 | type 13 | [Route('')] 14 | THomeController = class(THttpController) 15 | published 16 | [HttpGet,ActionName('Index')] 17 | function Index : IActionResult; 18 | 19 | [HttpGet('Random/{number:int?}'), OutputCache(5000)] 20 | function Random(Number : Integer = 10) : IActionResult; 21 | end; 22 | 23 | implementation 24 | 25 | { THomeController } 26 | 27 | function THomeController.Index: IActionResult; 28 | begin 29 | Result := Content('Use /random/{number} return value will be cached for 5 seconds'); 30 | end; 31 | 32 | function THomeController.Random(Number: Integer = 10): IActionResult; 33 | begin 34 | if Number < 1 then Result := StatusCode(THttpStatusCode.BadRequest,'Number too low!') 35 | else Result := Content(Format('Random(%d) = %d (cached for 5s)',[Number,System.Random(Number)])); 36 | end; 37 | 38 | initialization 39 | RegisterController(THomeController); 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/infrastructure/Infra.Data.Models.Costumer.pas: -------------------------------------------------------------------------------- 1 | unit Infra.Data.Models.Costumer; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Entity; 7 | 8 | type 9 | [Table('Costumers')] 10 | TDBCostumer = class(TEntity) 11 | private 12 | fId : TAutoID; 13 | fFirstName : string; 14 | fLastName : string; 15 | fPhone : string; 16 | fEmail : string; 17 | fStreet : string; 18 | fCity : string; 19 | fState : string; 20 | published 21 | [Key] 22 | property Id : TAutoID read fId write fId; 23 | [StringLength(50)] 24 | property FirstName : string read fFirstName write fFirstName; 25 | [StringLength(100)] 26 | property LastName : string read fLastName write fLastName; 27 | [StringLength(25)] 28 | property Phone : string read fPhone write fPhone; 29 | [StringLength(50)] 30 | property Email : string read fEmail write fEmail; 31 | [StringLength(100)] 32 | property Street : string read fStreet write fStreet; 33 | [StringLength(50)] 34 | property City : string read fCity write fCity; 35 | [StringLength(50)] 36 | property State : string read fState write fState; 37 | end; 38 | 39 | implementation 40 | 41 | end. 42 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | ShowEventColors: True 3 | ShowTimeStamp: True 4 | ShowEventType: False 5 | UnderlineHeaderEventType: False 6 | MaxFailsToRestart: 2 7 | MaxFailsToStop: 0 8 | Environment: "" 9 | IncludedInfo: [iiAppName,iiHost] 10 | SendLimits: 11 | TimeRange: slNoLimit 12 | LimitEventTypes: [] 13 | MaxSent: 0 14 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 15 | Enabled: True 16 | 17 | File: 18 | FileName: .\TaskControlService.log 19 | AutoFileNameByProcess: False 20 | MaxRotateFiles: 5 21 | MaxFileSizeInMB: 200 22 | DailyRotate: False 23 | RotatedFilesPath: "" 24 | CompressRotatedFiles: False 25 | ShowEventType: True 26 | ShowHeaderInfo: True 27 | UnderlineHeaderEventType: False 28 | AutoFlush: False 29 | MaxFailsToRestart: 2 30 | MaxFailsToStop: 0 31 | Environment: "" 32 | IncludedInfo: [iiAppName,iiHost,iiUserName,iiOSVersion] 33 | SendLimits: 34 | TimeRange: slNoLimit 35 | LimitEventTypes: [] 36 | MaxSent: 0 37 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDone,etCustom1,etCustom2] 38 | Enabled: True 39 | 40 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/bin/Win64/Debug/appSettings.yml: -------------------------------------------------------------------------------- 1 | ConnectionStrings: 2 | Connections: 3 | - Name: ShopContext 4 | Provider: "" 5 | ConnectionString: Database=.\\shop.db 6 | 7 | - Name: ShopContext2 8 | Provider: "" 9 | ConnectionString: Server=SERVER;Database=shop;User Id=user;Password=1234; 10 | 11 | 12 | IdentityOptions: 13 | LockOut: 14 | AllowedForNewUsers: false 15 | DefaultLockoutTimeSpan: null 16 | MaxFailedAccessAttempts: 0 17 | Password: 18 | RequireDigit: false 19 | RequiredLength: 6 20 | RequiredUniqueChars: 0 21 | RequireLowercase: false 22 | RequireNonAlphanumeric: false 23 | RequireUppercase: false 24 | SignIn: 25 | RequireConfirmedAccount: false 26 | RequireConfirmedEmail: false 27 | RequireConfirmedPhoneNumber: false 28 | Stores: 29 | MaxLengthForKeys: 0 30 | ProtectPersonalData: false 31 | Tokens: 32 | DefaultAuthenticatorProvider: "" 33 | DefaultEmailProvider: "" 34 | DefaultPhoneProvider: "" 35 | DefaultProvider: "" 36 | User: 37 | AllowedUserNameCharacters: "" 38 | RequireUniqueEmail: true 39 | 40 | ApiKey: 41 | UnAuthorizedErrorCode: 401 42 | UnAuthorizedErrorMessage: Not authenticated 43 | 44 | -------------------------------------------------------------------------------- /expert/CoreMvcExpert.dpk: -------------------------------------------------------------------------------- 1 | package CoreMvcExpert; 2 | 3 | {$R *.res} 4 | {$R *.dres} 5 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 6 | {$ALIGN 8} 7 | {$ASSERTIONS ON} 8 | {$BOOLEVAL OFF} 9 | {$DEBUGINFO OFF} 10 | {$EXTENDEDSYNTAX ON} 11 | {$IMPORTEDDATA ON} 12 | {$IOCHECKS ON} 13 | {$LOCALSYMBOLS ON} 14 | {$LONGSTRINGS ON} 15 | {$OPENSTRINGS ON} 16 | {$OPTIMIZATION OFF} 17 | {$OVERFLOWCHECKS OFF} 18 | {$RANGECHECKS OFF} 19 | {$REFERENCEINFO ON} 20 | {$SAFEDIVIDE OFF} 21 | {$STACKFRAMES ON} 22 | {$TYPEDADDRESS OFF} 23 | {$VARSTRINGCHECKS ON} 24 | {$WRITEABLECONST OFF} 25 | {$MINENUMSIZE 1} 26 | {$IMAGEBASE $400000} 27 | {$DEFINE DEBUG} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Quick Core MVC Project Wizard'} 30 | {$IMPLICITBUILD ON} 31 | 32 | requires 33 | rtl, 34 | designide; 35 | 36 | contains 37 | CoreMvc.Wizards in 'CoreMvc.Wizards.pas', 38 | CoreMvc.Wizards.Utils in 'CoreMvc.Wizards.Utils.pas', 39 | CoreMvc.Wizard.MainForm in 'CoreMvc.Wizard.MainForm.pas' {frmProjectWizard}, 40 | CoreMvc.ProjectCreator in 'CoreMvc.ProjectCreator.pas', 41 | CoreMvc.ControllerCreator in 'CoreMvc.ControllerCreator.pas', 42 | CoreMvc.StartupCreator in 'CoreMvc.StartupCreator.pas'; 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /Quick.Core.Extensions.FormFactory.pas: -------------------------------------------------------------------------------- 1 | unit Quick.Core.Extensions.FormFactory; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | {$IFDEF VCL} 8 | Vcl.Forms, 9 | {$ELSE} 10 | Fmx.Forms, 11 | {$ENDIF} 12 | Quick.Core.DependencyInjection; 13 | 14 | type 15 | TFormFactoryServiceExtension = class(TServiceCollectionExtension) 16 | class function AddFormFactory : TServiceCollection; 17 | end; 18 | 19 | TFormFactory = class 20 | var 21 | fServiceCollection : TServiceCollection; 22 | public 23 | constructor Create(aServiceCollection : TServiceCollection); 24 | function New : T; 25 | end; 26 | 27 | implementation 28 | 29 | { TFormFactoryServiceExtension } 30 | 31 | class function TFormFactoryServiceExtension.AddFormFactory : TServiceCollection; 32 | begin 33 | Result := ServiceCollection; 34 | Result.AddSingleton('',function : TFormFactory 35 | begin 36 | Result := TFormFactory.Create(ServiceCollection); 37 | end); 38 | end; 39 | 40 | { TFormFactory } 41 | 42 | constructor TFormFactory.Create(aServiceCollection: TServiceCollection); 43 | begin 44 | fServiceCollection := aServiceCollection; 45 | end; 46 | 47 | function TFormFactory.New: T; 48 | begin 49 | Result := fServiceCollection.AbstractFactory; 50 | end; 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /samples/delphi/SimpleController/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Logging, 10 | Controller.Home; 11 | 12 | type 13 | TStartup = class(TStartupMvc) 14 | public 15 | class procedure ConfigureServices(services : TServiceCollection); override; 16 | class procedure Configure(app : TMVCServer); override; 17 | end; 18 | 19 | implementation 20 | 21 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 22 | begin 23 | services 24 | .AddLogging(TLoggerBuilder.GetBuilder 25 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 26 | begin 27 | aOptions.LogLevel := LOG_DEBUG; 28 | aOptions.ShowEventColors := True; 29 | aOptions.ShowTimeStamp := True; 30 | aOptions.ShowEventType := False; 31 | aOptions.Enabled := True; 32 | end) 33 | .Build) 34 | .AddDebugger; 35 | end; 36 | 37 | class procedure TStartup.Configure(app : TMVCServer); 38 | begin 39 | app 40 | .AddControllers 41 | .AddController(THomeController) 42 | .DefaultRoute(THomeController,'Home/Index') 43 | .UseWebRoot('.\wwwroot') 44 | .UseRouting 45 | .UseMVC; 46 | end; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/TaskControlServer.Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit TaskControlServer.Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Core.TaskControl, 11 | Quick.Threads, 12 | Quick.Commons; 13 | 14 | type 15 | THomeController = class(THttpController) 16 | private 17 | fTaskControl : ITaskControl; 18 | public 19 | constructor Create(aTaskControl : ITaskControl); 20 | published 21 | [HttpGet('Home'),ActionName('Index')] 22 | function Index : IActionResult; 23 | end; 24 | 25 | implementation 26 | 27 | { THomeController } 28 | 29 | constructor THomeController.Create(aTaskControl: ITaskControl); 30 | begin 31 | fTaskControl := aTaskControl; 32 | end; 33 | 34 | function THomeController.Index: IActionResult; 35 | var 36 | i : Integer; 37 | begin 38 | for i := 0 to 1000 do 39 | begin 40 | fTaskControl.BackgroundTasks.AddTask(procedure(aTask : ITask) 41 | begin 42 | Sleep(2000); 43 | end); 44 | end; 45 | 46 | Result := Content('Doing tasks!'); 47 | end; 48 | 49 | initialization 50 | RegisterController(THomeController); 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | MaxFailsToRestart: 2 3 | MaxFailsToStop: 0 4 | AppName: ServerRedisMessageQueue 5 | Environment: "" 6 | IncludedInfo: [iiAppName,iiHost] 7 | SendLimits: 8 | TimeRange: slNoLimit 9 | LimitEventTypes: [] 10 | MaxSent: 0 11 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 12 | CustomMsgOutput: false 13 | Enabled: true 14 | ShowEventColors: true 15 | ShowTimeStamp: true 16 | ShowEventType: false 17 | UnderlineHeaderEventType: false 18 | 19 | File: 20 | MaxFailsToRestart: 2 21 | MaxFailsToStop: 0 22 | AppName: ServerRedisMessageQueue 23 | Environment: "" 24 | IncludedInfo: [iiAppName,iiHost,iiUserName,iiOSVersion] 25 | SendLimits: 26 | TimeRange: slNoLimit 27 | LimitEventTypes: [] 28 | MaxSent: 0 29 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 30 | CustomMsgOutput: false 31 | Enabled: true 32 | FileName: "" 33 | AutoFileNameByProcess: false 34 | MaxRotateFiles: 5 35 | MaxFileSizeInMB: 20 36 | DailyRotate: false 37 | RotatedFilesPath: "" 38 | CompressRotatedFiles: false 39 | ShowEventType: true 40 | ShowHeaderInfo: true 41 | UnderlineHeaderEventType: false 42 | AutoFlush: false 43 | 44 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/bin/Win64/Debug/QuickLogger.yml: -------------------------------------------------------------------------------- 1 | Console: 2 | MaxFailsToRestart: 2 3 | MaxFailsToStop: 0 4 | AppName: ServerApiKeyMemoryStore 5 | Environment: "" 6 | IncludedInfo: [iiAppName,iiHost] 7 | SendLimits: 8 | TimeRange: slNoLimit 9 | LimitEventTypes: [] 10 | MaxSent: 0 11 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDebug,etTrace,etDone] 12 | CustomMsgOutput: false 13 | Enabled: true 14 | ShowEventColors: true 15 | ShowTimeStamp: true 16 | ShowEventType: false 17 | UnderlineHeaderEventType: false 18 | 19 | File: 20 | MaxFailsToRestart: 2 21 | MaxFailsToStop: 0 22 | AppName: ServerApiKeyMemoryStore 23 | Environment: "" 24 | IncludedInfo: [iiAppName,iiHost,iiUserName,iiOSVersion] 25 | SendLimits: 26 | TimeRange: slNoLimit 27 | LimitEventTypes: [] 28 | MaxSent: 0 29 | LogLevel: [etHeader,etInfo,etSuccess,etWarning,etError,etCritical,etException,etDone,etCustom1,etCustom2] 30 | CustomMsgOutput: false 31 | Enabled: true 32 | FileName: .\WebApiServer.log 33 | AutoFileNameByProcess: false 34 | MaxRotateFiles: 5 35 | MaxFileSizeInMB: 200 36 | DailyRotate: false 37 | RotatedFilesPath: "" 38 | CompressRotatedFiles: false 39 | ShowEventType: true 40 | ShowHeaderInfo: true 41 | UnderlineHeaderEventType: false 42 | AutoFlush: false 43 | 44 | -------------------------------------------------------------------------------- /samples/delphi/ResponseCaching/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Logging, 10 | Quick.Core.Mvc.Extensions.ResponseCaching, 11 | Controller.Home; 12 | 13 | type 14 | TStartup = class(TStartupMvc) 15 | public 16 | class procedure ConfigureServices(services : TServiceCollection); override; 17 | class procedure Configure(app : TMVCServer); override; 18 | end; 19 | 20 | implementation 21 | 22 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 23 | begin 24 | services 25 | .AddLogging(TLoggerBuilder.GetBuilder 26 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 27 | begin 28 | aOptions.LogLevel := LOG_DEBUG; 29 | aOptions.ShowEventColors := True; 30 | aOptions.ShowTimeStamp := True; 31 | aOptions.ShowEventType := False; 32 | aOptions.Enabled := True; 33 | end) 34 | .Build) 35 | .AddDebugger 36 | //add response caching 37 | .Extension 38 | .AddResponseCaching 39 | end; 40 | 41 | class procedure TStartup.Configure(app : TMVCServer); 42 | begin 43 | app 44 | .AddControllers 45 | .DefaultRoute(THomeController,'Home/Index') 46 | //.DefaultController(THomeController); 47 | //.MapRoute('default',TTestController,'{controller=Test}/{action=Index}/{id?}') 48 | .UseWebRoot('.\wwwroot') 49 | .Extension 50 | .UseResponseCaching 51 | .UseRouting 52 | .UseMVC; 53 | end; 54 | 55 | end. 56 | -------------------------------------------------------------------------------- /expert/CoreMvc.Template.Project.txt: -------------------------------------------------------------------------------- 1 | program {%PROJECTNAME%}; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Quick.Core.Mvc.WebApi, 14 | Startup in 'Startup.pas'; 15 | 16 | var 17 | ApiServer : TWebApiServer; 18 | 19 | begin 20 | try 21 | //run as console 22 | if not AppService.IsRunningAsService then 23 | begin 24 | //create server 25 | cout('Init server...',etInfo); 26 | ApiServer := TWebApiServer.Create('127.0.0.1',8080,False); 27 | try 28 | ApiServer.UseStartup; 29 | ApiServer.Start; 30 | //Wait for Exit 31 | cout(' ',ccWhite); 32 | cout('Press [Enter] to quit',ccYellow); 33 | ConsoleWaitForEnterKey; 34 | finally 35 | ApiServer.Free; 36 | end; 37 | end 38 | else //run as a service 39 | begin 40 | AppService.DisplayName := '{%PROJECTNAME%}'; 41 | AppService.ServiceName := '{%PROJECTNAME%}' + 'Svc'; 42 | AppService.CanInstallWithOtherName := True; 43 | AppService.OnStart := procedure 44 | begin 45 | ApiServer := TWebApiServer.Create('127.0.0.1',8080,False); 46 | ApiServer.UseStartup; 47 | end; 48 | AppService.OnStop := ApiServer.Free; 49 | AppService.OnExecute := ApiServer.Start; 50 | AppService.CheckParams; 51 | end; 52 | except 53 | on E: Exception do 54 | Writeln(E.ClassName, ': ', E.Message); 55 | end; 56 | end. 57 | -------------------------------------------------------------------------------- /samples/delphi/SimpleController/SimpleServer.dpr: -------------------------------------------------------------------------------- 1 | program SimpleServer; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Startup in 'Startup.pas', 14 | Controller.Home in 'controllers\Controller.Home.pas'; 15 | 16 | var 17 | ApiServer : TMvcServer; 18 | 19 | begin 20 | try 21 | ReportMemoryLeaksOnShutdown := True; 22 | //run as console 23 | if not AppService.IsRunningAsService then 24 | begin 25 | //create server 26 | cout('Init server...',etInfo); 27 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 28 | try 29 | ApiServer.UseStartup; 30 | ApiServer.Start; 31 | //Wait for Exit 32 | cout(' ',ccWhite); 33 | cout('Press [Enter] to quit',ccYellow); 34 | ConsoleWaitForEnterKey; 35 | finally 36 | ApiServer.Free; 37 | end; 38 | end 39 | else //run as a service 40 | begin 41 | AppService.DisplayName := 'Quick Server'; 42 | AppService.ServiceName := 'QuickServerSvc'; 43 | AppService.CanInstallWithOtherName := True; 44 | AppService.OnStart := procedure 45 | begin 46 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 47 | ApiServer.UseStartup; 48 | end; 49 | AppService.OnExecute := ApiServer.Start; 50 | AppService.CheckParams; 51 | end; 52 | except 53 | on E: Exception do 54 | Writeln(E.ClassName, ': ', E.Message); 55 | end; 56 | end. 57 | -------------------------------------------------------------------------------- /samples/delphi/ResponseCaching/ServerResponseCaching.dpr: -------------------------------------------------------------------------------- 1 | program ServerResponseCaching; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Startup in 'Startup.pas', 14 | Controller.Home in 'controllers\Controller.Home.pas'; 15 | 16 | var 17 | ApiServer : TMvcServer; 18 | 19 | begin 20 | try 21 | ReportMemoryLeaksOnShutdown := True; 22 | //run as console 23 | if not AppService.IsRunningAsService then 24 | begin 25 | //create server 26 | cout('Init server...',etInfo); 27 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 28 | try 29 | ApiServer.UseStartup; 30 | ApiServer.Start; 31 | //Wait for Exit 32 | cout(' ',ccWhite); 33 | cout('Press [Enter] to quit',ccYellow); 34 | ConsoleWaitForEnterKey; 35 | finally 36 | ApiServer.Free; 37 | end; 38 | end 39 | else //run as a service 40 | begin 41 | AppService.DisplayName := 'Quick Server'; 42 | AppService.ServiceName := 'QuickServerSvc'; 43 | AppService.CanInstallWithOtherName := True; 44 | AppService.OnStart := procedure 45 | begin 46 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 47 | ApiServer.UseStartup; 48 | end; 49 | AppService.OnExecute := ApiServer.Start; 50 | AppService.CheckParams; 51 | end; 52 | except 53 | on E: Exception do 54 | Writeln(E.ClassName, ': ', E.Message); 55 | end; 56 | end. 57 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/ServerApiKeyMemoryStore.dpr: -------------------------------------------------------------------------------- 1 | program ServerApiKeyMemoryStore; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Startup in 'Startup.pas', 14 | Controller.Home in 'controllers\Controller.Home.pas'; 15 | 16 | var 17 | ApiServer : TMvcServer; 18 | 19 | begin 20 | try 21 | ReportMemoryLeaksOnShutdown := True; 22 | //run as console 23 | if not AppService.IsRunningAsService then 24 | begin 25 | //create server 26 | cout('Init server...',etInfo); 27 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 28 | try 29 | ApiServer.UseStartup; 30 | ApiServer.Start; 31 | //Wait for Exit 32 | cout(' ',ccWhite); 33 | cout('Press [Enter] to quit',ccYellow); 34 | ConsoleWaitForEnterKey; 35 | finally 36 | ApiServer.Free; 37 | end; 38 | end 39 | else //run as a service 40 | begin 41 | AppService.DisplayName := 'Quick Server'; 42 | AppService.ServiceName := 'QuickServerSvc'; 43 | AppService.CanInstallWithOtherName := True; 44 | AppService.OnStart := procedure 45 | begin 46 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 47 | ApiServer.UseStartup; 48 | end; 49 | AppService.OnExecute := ApiServer.Start; 50 | AppService.CheckParams; 51 | end; 52 | except 53 | on E: Exception do 54 | Writeln(E.ClassName, ': ', E.Message); 55 | end; 56 | end. 57 | -------------------------------------------------------------------------------- /samples/delphi/DistributedCaching/ServerDistributedCaching.dpr: -------------------------------------------------------------------------------- 1 | program ServerDistributedCaching; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Startup in 'Startup.pas', 14 | Controller.Home in 'controllers\Controller.Home.pas'; 15 | 16 | var 17 | ApiServer : TMvcServer; 18 | 19 | begin 20 | try 21 | ReportMemoryLeaksOnShutdown := True; 22 | //run as console 23 | if not AppService.IsRunningAsService then 24 | begin 25 | //create server 26 | cout('Init server...',etInfo); 27 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 28 | try 29 | ApiServer.UseStartup; 30 | ApiServer.Start; 31 | //Wait for Exit 32 | cout(' ',ccWhite); 33 | cout('Press [Enter] to quit',ccYellow); 34 | ConsoleWaitForEnterKey; 35 | finally 36 | ApiServer.Free; 37 | end; 38 | end 39 | else //run as a service 40 | begin 41 | AppService.DisplayName := 'Quick Server'; 42 | AppService.ServiceName := 'QuickServerSvc'; 43 | AppService.CanInstallWithOtherName := True; 44 | AppService.OnStart := procedure 45 | begin 46 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 47 | ApiServer.UseStartup; 48 | end; 49 | AppService.OnExecute := ApiServer.Start; 50 | AppService.CheckParams; 51 | end; 52 | except 53 | on E: Exception do 54 | Writeln(E.ClassName, ': ', E.Message); 55 | end; 56 | end. 57 | -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/ServerRedisMessageQueue.dpr: -------------------------------------------------------------------------------- 1 | program ServerRedisMessageQueue; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Startup in 'Startup.pas', 14 | Controller.Home in 'controllers\Controller.Home.pas', 15 | PingTask in 'PingTask.pas'; 16 | 17 | var 18 | ApiServer : TMvcServer; 19 | 20 | begin 21 | try 22 | ReportMemoryLeaksOnShutdown := True; 23 | //run as console 24 | if not AppService.IsRunningAsService then 25 | begin 26 | //create server 27 | cout('Init server...',etInfo); 28 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 29 | try 30 | ApiServer.UseStartup; 31 | ApiServer.Start; 32 | //Wait for Exit 33 | cout(' ',ccWhite); 34 | cout('Press [Enter] to quit',ccYellow); 35 | ConsoleWaitForEnterKey; 36 | finally 37 | ApiServer.Free; 38 | end; 39 | end 40 | else //run as a service 41 | begin 42 | AppService.DisplayName := 'Quick Server'; 43 | AppService.ServiceName := 'QuickServerSvc'; 44 | AppService.CanInstallWithOtherName := True; 45 | AppService.OnStart := procedure 46 | begin 47 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 48 | ApiServer.UseStartup; 49 | end; 50 | AppService.OnExecute := ApiServer.Start; 51 | AppService.CheckParams; 52 | end; 53 | except 54 | on E: Exception do 55 | Writeln(E.ClassName, ': ', E.Message); 56 | end; 57 | end. 58 | -------------------------------------------------------------------------------- /samples/delphi/DistributedCaching/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Logging, 10 | Quick.Core.Mvc.Extensions.ResponseCaching, 11 | Quick.Core.Extensions.Caching.Redis, 12 | Controller.Home; 13 | 14 | type 15 | TStartup = class(TStartupMvc) 16 | public 17 | class procedure ConfigureServices(services : TServiceCollection); override; 18 | class procedure Configure(app : TMVCServer); override; 19 | end; 20 | 21 | implementation 22 | 23 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 24 | begin 25 | services 26 | .AddLogging(TLoggerBuilder.GetBuilder 27 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 28 | begin 29 | aOptions.LogLevel := LOG_DEBUG; 30 | aOptions.ShowEventColors := True; 31 | aOptions.ShowTimeStamp := True; 32 | aOptions.ShowEventType := False; 33 | aOptions.Enabled := True; 34 | end) 35 | .Build) 36 | .AddDebugger 37 | //add response caching 38 | .Extension 39 | .AddDistributedRedisCache(procedure(aOptions : TRedisCacheOptions) 40 | begin 41 | aOptions.PoolSize := 100; 42 | aOptions.Host := '192.168.1.11'; 43 | aOptions.Port := 6379; 44 | aOptions.Password := 'pass123'; 45 | aOptions.DatabaseNumber := 1; 46 | end); 47 | end; 48 | 49 | class procedure TStartup.Configure(app : TMVCServer); 50 | begin 51 | app 52 | .AddControllers 53 | .AddController(THomeController) 54 | .DefaultRoute(THomeController,'Home/Index') 55 | .UseWebRoot('.\wwwroot') 56 | .Extension 57 | .UseResponseCaching 58 | .UseRouting 59 | .UseMVC; 60 | end; 61 | 62 | end. 63 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/TaskControlServer.dpr: -------------------------------------------------------------------------------- 1 | program TaskControlServer; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Quick.Core.Mvc.Controller, 14 | Quick.Core.Mvc.Context, 15 | Quick.Core.DependencyInjection, 16 | Quick.Core.TaskControl in '..\..\..\Quick.Core.TaskControl.pas', 17 | Quick.Core.Extensions.MVC.TaskControl, 18 | TaskControlServer.Controller.Home in 'TaskControlServer.Controller.Home.pas', 19 | TaskControlServer.Config.App in 'TaskControlServer.Config.App.pas', 20 | Startup in 'Startup.pas'; 21 | 22 | var 23 | Server : TMVCServer; 24 | 25 | begin 26 | try 27 | //run as console 28 | if not AppService.IsRunningAsService then 29 | begin 30 | //create server 31 | cout('Init server...',etInfo); 32 | Server := TMVCServer.Create('127.0.0.1',8080,False); 33 | try 34 | Server.UseStartup; 35 | Server.Start; 36 | //Wait for Exit 37 | cout(' ',ccWhite); 38 | cout('Press [Enter] to quit',ccYellow); 39 | ConsoleWaitForEnterKey; 40 | finally 41 | Server.Free; 42 | end; 43 | end 44 | else //run as a service 45 | begin 46 | AppService.DisplayName := 'Remote Server'; 47 | AppService.ServiceName := 'RemoteServerSvc'; 48 | AppService.CanInstallWithOtherName := True; 49 | AppService.OnStart := procedure 50 | begin 51 | Server := TMVCServer.Create('127.0.0.1',8080,False); 52 | Server.UseStartup; 53 | end; 54 | AppService.OnStop := Server.Free; 55 | AppService.OnExecute := Server.Start; 56 | AppService.CheckParams; 57 | end; 58 | except 59 | on E: Exception do 60 | Writeln(E.ClassName, ': ', E.Message); 61 | end; 62 | end. 63 | -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/controllers/Controller.Home.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Home; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.HttpServer.Types, 8 | Quick.Core.Mvc.Controller, 9 | Quick.Core.Mvc.ActionResult, 10 | Quick.Core.MessageQueue.Abstractions, 11 | Quick.Commons, 12 | PingTask; 13 | 14 | type 15 | [Route('')] 16 | THomeController = class(THttpController) 17 | private 18 | fMessageQueue : IMessageQueue; 19 | public 20 | constructor Create(aMessageQueue : IMessageQueue); 21 | published 22 | [HttpGet('Home'),ActionName('Index')] 23 | function Index : IActionResult; 24 | 25 | [HttpGet('Push/{host}')] 26 | function Push(const host : string) : IActionResult; 27 | 28 | [HttpGet('Pop')] 29 | function Pop : IActionResult; 30 | 31 | end; 32 | 33 | implementation 34 | 35 | { THomeController } 36 | 37 | constructor THomeController.Create(aMessageQueue: IMessageQueue); 38 | begin 39 | fMessageQueue := aMessageQueue; 40 | end; 41 | 42 | function THomeController.Index: IActionResult; 43 | begin 44 | Result := Content('Use /Push/{hostname} to add to queue and /Pop to retrieve from queue'); 45 | end; 46 | 47 | function THomeController.Push(const host: string): IActionResult; 48 | var 49 | pingtask : TPingTask; 50 | begin 51 | PingTask := TPingTask.Create; 52 | try 53 | PingTask.Id := NewGuidStr; 54 | PingTask.Host := host; 55 | fMessageQueue.Push(pingtask); 56 | finally 57 | PingTask.Free; 58 | end; 59 | Result := Content('Add task to Redis Message Queue'); 60 | end; 61 | 62 | function THomeController.Pop: IActionResult; 63 | var 64 | pingtask : TPingTask; 65 | begin 66 | if fMessageQueue.Pop(PingTask) = TMSQWaitResult.wrTimeout then Exit(Content('No more tasks found!')); 67 | try 68 | Result := Content(PingTask.Host); 69 | finally 70 | PingTask.Free; 71 | end; 72 | end; 73 | 74 | initialization 75 | RegisterController(THomeController); 76 | 77 | end. 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | *.db-journal 71 | *.delphilsp.json 72 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/ServerApiKeyDatabaseStore.dpr: -------------------------------------------------------------------------------- 1 | program ServerApiKeyDatabaseStore; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.Mvc, 13 | Controller.Home in 'controllers\Controller.Home.pas', 14 | Startup in 'Startup.pas', 15 | Infra.Data.DBContext.Shop in 'infrastructure\Infra.Data.DBContext.Shop.pas', 16 | Infra.Data.Models.Costumer in 'infrastructure\Infra.Data.Models.Costumer.pas', 17 | Infra.Data.Models.Product in 'infrastructure\Infra.Data.Models.Product.pas', 18 | Controller.Products in 'controllers\Controller.Products.pas', 19 | Infra.Data.Identities in 'infrastructure\Identities\Infra.Data.Identities.pas'; 20 | 21 | var 22 | ApiServer : TMvcServer; 23 | 24 | begin 25 | try 26 | ReportMemoryLeaksOnShutdown := True; 27 | //run as console 28 | if not AppService.IsRunningAsService then 29 | begin 30 | //create server 31 | cout('Init server...',etInfo); 32 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 33 | try 34 | ApiServer.UseStartup; 35 | ApiServer.Start; 36 | //Wait for Exit 37 | cout(' ',ccWhite); 38 | cout('Press [Enter] to quit',ccYellow); 39 | ConsoleWaitForEnterKey; 40 | finally 41 | ApiServer.Free; 42 | end; 43 | end 44 | else //run as a service 45 | begin 46 | AppService.DisplayName := 'Quick Server'; 47 | AppService.ServiceName := 'QuickServerSvc'; 48 | AppService.CanInstallWithOtherName := True; 49 | AppService.OnStart := procedure 50 | begin 51 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 52 | ApiServer.UseStartup; 53 | end; 54 | AppService.OnExecute := ApiServer.Start; 55 | AppService.CheckParams; 56 | end; 57 | except 58 | on E: Exception do 59 | Writeln(E.ClassName, ': ', E.Message); 60 | end; 61 | end. 62 | -------------------------------------------------------------------------------- /Quick.Core.Extensions.Service.Abstractions.pas: -------------------------------------------------------------------------------- 1 | unit Quick.Core.Extensions.Service.Abstractions; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | Quick.Core.Logging.Abstractions, 8 | Quick.Core.Extensions.Hosting; 9 | 10 | type 11 | TSvcInitializeEvent = procedure of object; 12 | TSvcAnonMethod = reference to procedure; 13 | TSvcRemoveEvent = procedure of object; 14 | 15 | IHostService = interface(IHost) 16 | ['{79251D22-01C3-44EF-8E8A-4C2CAC7DA510}'] 17 | procedure Start; 18 | procedure Stop; 19 | procedure Install; 20 | procedure Remove; 21 | function CheckParams : Boolean; 22 | function IsRunningAsService : Boolean; 23 | end; 24 | 25 | THostService = class(TInterfacedObject,IHostService) 26 | private 27 | fLogger : ILogger; 28 | fOnExecute: TSvcAnonMethod; 29 | fWaitForKeyOnExit: Boolean; 30 | fOnStop: TSvcAnonMethod; 31 | fOnStart: TSvcAnonMethod; 32 | fOnInitialize: TSvcInitializeEvent; 33 | fServiceName: string; 34 | fPassword: string; 35 | fUser: string; 36 | fDescription: string; 37 | public 38 | property ServiceName : string read fServiceName write fServiceName; 39 | property User : string read fUser write fUser; 40 | property Password : string read fPassword write fPassword; 41 | property Description : string read fDescription write fDescription; 42 | property OnInitialize : TSvcInitializeEvent read fOnInitialize write fOnInitialize; 43 | property OnStart : TSvcAnonMethod read fOnStart write fOnStart; 44 | property OnStop : TSvcAnonMethod read fOnStop write fOnStop; 45 | property OnExecute : TSvcAnonMethod read fOnExecute write fOnExecute; 46 | property WaitForKeyOnExit : Boolean read fWaitForKeyOnExit write fWaitForKeyOnExit; 47 | property Logger : ILogger read fLogger write fLogger; 48 | procedure Start; virtual; abstract; 49 | procedure Stop; virtual; abstract; 50 | procedure Install; virtual; abstract; 51 | procedure Remove; virtual; abstract; 52 | function CheckParams : Boolean; virtual; abstract; 53 | function IsRunningAsService : Boolean; virtual; abstract; 54 | end; 55 | 56 | implementation 57 | 58 | end. 59 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Logging, 9 | Quick.Core.Mvc.Context, 10 | Quick.Core.TaskControl, 11 | Quick.Core.Extensions.MVC.TaskControl, 12 | TaskControlServer.Config.App, 13 | TaskControlServer.Controller.Home; 14 | 15 | type 16 | TStartup = class(TStartupBase) 17 | public 18 | class procedure ConfigureServices(services : TServiceCollection); override; 19 | class procedure Configure(app : TMVCServer); override; 20 | end; 21 | 22 | implementation 23 | 24 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 25 | begin 26 | services 27 | .AddLogging(TLoggerBuilder.GetBuilder//(TLoggerOptionsFormat.ofYAML,False) 28 | .AddConsole(procedure(aOptions : TLoggerConsoleOptions) 29 | begin 30 | aOptions.LogLevel := LOG_DEBUG; 31 | aOptions.ShowEventColors := True; 32 | aOptions.ShowTimeStamp := True; 33 | aOptions.ShowEventType := False; 34 | aOptions.Enabled := True; 35 | end) 36 | .AddFile(procedure(aOptions : TLoggerFileOptions) 37 | begin 38 | aOptions.FileName := '.\TaskControlService.log'; 39 | aOptions.MaxFileSizeInMB := 200; 40 | aOptions.Enabled := True; 41 | end) 42 | .Build 43 | ) 44 | .AddOptions(TOptionsFileFormat.ofJSON,True) 45 | .Configure(procedure(aOptions : TAppSettings) 46 | begin 47 | aOptions.Smtp := 'mail.domain.com'; 48 | aOptions.Email := 'info@domain.com'; 49 | end) 50 | .Extension.AddTaskControl; 51 | end; 52 | 53 | class procedure TStartup.Configure(app : TMVCServer); 54 | begin 55 | app 56 | .AddControllers 57 | .AddController(THomeController) 58 | //configure routing 59 | .DefaultRoute(THomeController,'Home/Index') 60 | .UseWebRoot('.\wwwroot') 61 | .UseRouting 62 | .UseMVC 63 | .Extension.UseTaskControl; 64 | end; 65 | 66 | end. 67 | 68 | -------------------------------------------------------------------------------- /samples/delphi/MessageQueue/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Logging, 10 | Quick.Core.Extensions.MessageQueue.Redis, 11 | Controller.Home, 12 | PingTask; 13 | 14 | type 15 | TStartup = class(TStartupMvc) 16 | public 17 | class procedure ConfigureServices(services : TServiceCollection); override; 18 | class procedure Configure(app : TMVCServer); override; 19 | end; 20 | 21 | implementation 22 | 23 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 24 | begin 25 | services 26 | .AddLogging(TLoggerBuilder.GetBuilder 27 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 28 | begin 29 | aOptions.LogLevel := LOG_DEBUG; 30 | aOptions.ShowEventColors := True; 31 | aOptions.ShowTimeStamp := True; 32 | aOptions.ShowEventType := False; 33 | aOptions.Enabled := True; 34 | end) 35 | .AddFile(procedure(aOptions : TFileLoggerOptions) 36 | begin 37 | aOptions.LogLevel := LOG_DEBUG; 38 | aOptions.Enabled := True; 39 | end) 40 | .Build) 41 | .AddDebugger 42 | .AddOptions(TOptionsFileFormat.ofYAML,True); 43 | services.Extension 44 | .AddRedisMessageQueue(procedure(aOptions : TRedisMessageQueueOptions) 45 | begin 46 | aOptions.Host := 'klingon'; 47 | aOptions.Port := 6379; 48 | aOptions.DataBase := 2; 49 | aOptions.Key := 'mailqueue'; 50 | aOptions.Password := 'pass123'; 51 | aOptions.PopTimeoutSec := 40; 52 | aOptions.MaxProducersPool := 10; 53 | aOptions.MaxConsumersPool := 10; 54 | aOptions.ReliableMessageQueue.CheckHangedMessagesIntervalSec := 30; 55 | aOptions.ReliableMessageQueue.DetermineAsHangedAfterSec := 60; 56 | aOptions.ReliableMessageQueue.Enabled := True; 57 | end); 58 | end; 59 | 60 | class procedure TStartup.Configure(app : TMVCServer); 61 | begin 62 | app 63 | .AddControllers 64 | .AddController(THomeController) 65 | .DefaultRoute(THomeController,'Home/Index') 66 | .UseWebRoot('.\wwwroot') 67 | .UseRouting 68 | .UseMVC; 69 | end; 70 | 71 | end. 72 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/controllers/Controller.Products.pas: -------------------------------------------------------------------------------- 1 | unit Controller.Products; 2 | 3 | interface 4 | 5 | uses 6 | System.SysUtils, 7 | System.Generics.Collections, 8 | Quick.HttpServer.Types, 9 | Quick.Collections, 10 | Quick.Core.Mvc.Controller, 11 | Quick.Core.Mvc.ActionResult, 12 | Quick.Core.Entity, 13 | Infra.Data.DBContext.Shop, 14 | Infra.Data.Models.Product, 15 | Quick.Core.Mapping.Abstractions; 16 | 17 | type 18 | [Route('Product')] 19 | [Authorize('Admin')] 20 | TProductsController = class(THttpController) 21 | private 22 | fdbcontext : TShopContext; 23 | public 24 | constructor Create(dbcontext : TShopContext); 25 | published 26 | [HttpGet('Add/{productname}/{price}')] 27 | function Add(const ProductName : string; Price : Integer): IActionResult; 28 | [HttpGet] 29 | function GetAll : IActionResult; 30 | [HttpPost] 31 | function Post([FromBody] aProduct : TDBProduct) : IActionResult; 32 | [HttpGet('{id}')] 33 | function GetById(id : Integer) : IActionResult; 34 | end; 35 | 36 | implementation 37 | 38 | { TProductsController } 39 | 40 | constructor TProductsController.Create(dbcontext : TShopContext); 41 | begin 42 | fdbcontext := dbcontext; 43 | end; 44 | 45 | function TProductsController.GetById(id: Integer): IActionResult; 46 | var 47 | dbproduct : TDBProduct; 48 | begin 49 | dbproduct := fdbcontext.Products.Where('Id=?',[id]).SelectFirst; 50 | try 51 | Result := Json(dbproduct,True); 52 | finally 53 | dbproduct.Free; 54 | end; 55 | end; 56 | 57 | function TProductsController.Post(aProduct: TDBProduct): IActionResult; 58 | begin 59 | fdbcontext.Products.AddOrUpdate(aProduct); 60 | aProduct.Free; 61 | Result := Content('Record added to database'); 62 | end; 63 | 64 | function TProductsController.Add(const ProductName : string; Price : Integer): IActionResult; 65 | var 66 | product : TDBProduct; 67 | begin 68 | product := TDBProduct.Create; 69 | try 70 | product.Name := ProductName; 71 | product.Price := Price; 72 | fdbcontext.Products.Add(product); 73 | finally 74 | product.Free; 75 | end; 76 | Result := Content('Record added to database'); 77 | end; 78 | 79 | function TProductsController.GetAll: IActionResult; 80 | var 81 | products : TObjectList; 82 | begin 83 | products := TObjectList.Create(True); 84 | try 85 | fdbcontext.Products.Select.ToObjectList(products); 86 | Result := Json(products,True); 87 | finally 88 | products.Free; 89 | end; 90 | end; 91 | 92 | initialization 93 | RegisterController(TProductsController); 94 | 95 | end. 96 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyMemoryStore/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Extensions.Caching.Memory, 10 | Quick.Core.Mvc.Extensions.ResponseCaching, 11 | Quick.Core.Extensions.Caching.Redis, 12 | Quick.Core.Extensions.Entity, 13 | Quick.Core.Extensions.AutoMapper, 14 | Quick.Core.Logging, 15 | Quick.Core.Mvc.Context, 16 | Quick.Core.Identity, 17 | Quick.Core.Security.Claims, 18 | Quick.Core.Security.Authorization, 19 | Quick.Core.Extensions.Authentication, 20 | Quick.Core.Extensions.Authorization, 21 | Quick.Core.Extensions.Authentication.ApiKey, 22 | Controller.Home; 23 | 24 | type 25 | TStartup = class(TStartupMvc) 26 | public 27 | class procedure ConfigureServices(services : TServiceCollection); override; 28 | class procedure Configure(app : TMVCServer); override; 29 | end; 30 | 31 | implementation 32 | 33 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 34 | begin 35 | services 36 | .AddLogging(TLoggerBuilder.GetBuilder(TLoggerOptionsFormat.ofYAML,False) 37 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 38 | begin 39 | aOptions.LogLevel := LOG_DEBUG; 40 | aOptions.ShowEventColors := True; 41 | aOptions.ShowTimeStamp := True; 42 | aOptions.ShowEventType := False; 43 | aOptions.Enabled := True; 44 | end) 45 | .AddFile(procedure(aOptions : TFileLoggerOptions) 46 | begin 47 | aOptions.FileName := '.\WebApiServer.log'; 48 | aOptions.MaxFileSizeInMB := 200; 49 | aOptions.Enabled := True; 50 | end) 51 | .Build 52 | ) 53 | .AddDebugger 54 | .AddOptions(TOptionsFileFormat.ofYAML,True) 55 | //add Authentication 56 | .Extension() 57 | .AddAuthentication(procedure(aOptions : TAuthenticationOptions) 58 | begin 59 | 60 | end); 61 | //add ApiKey Authentication 62 | services.Extension 63 | .AddApiKey() 64 | .UseMemoryStore(procedure(aOptions : TApiKeyMemoryStoreOptions) 65 | begin 66 | aOptions.AddApiKey('John','Admin','fkjsfVMfskdfkaiienvz23k12nfaadfavbkx'); 67 | aOptions.AddApiKey('Peter','User','mmvkasffoasd034jadsfkvnaaj3bfajxcfh'); 68 | end); 69 | //add Authorization 70 | services.Extension 71 | .AddAuthorization(procedure(aOptions : TAuthorizationOptions) 72 | begin 73 | aOptions.AddPolicy('ApiKeyValidation',TAuthorizationPolicyBuilder.GetBuilder 74 | .RequireAuthenticatedUser.Build 75 | //.RequireClaim(TClaimTypes.Role,'Admin').Build 76 | ); 77 | end); 78 | end; 79 | 80 | class procedure TStartup.Configure(app : TMVCServer); 81 | begin 82 | app 83 | .AddControllers 84 | .AddController(THomeController) 85 | .DefaultRoute(THomeController,'Home/Index') 86 | .UseWebRoot('.\wwwroot') 87 | .UseStaticFiles 88 | .UseRouting 89 | .UseAuthentication 90 | .UseAuthorization 91 | .UseMustachePages 92 | .UseMVC; 93 | end; 94 | 95 | end. 96 | -------------------------------------------------------------------------------- /expert/CoreMvc.Template.Startup.txt: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | WebApiService.DBContext.Shop, 10 | Quick.Core.Extensions.MVC.ResponseCaching, 11 | Quick.Core.Extensions.MemoryCache, 12 | Quick.Core.Extensions.Entity, 13 | Quick.Core.Extensions.AutoMapper, 14 | Quick.Core.Logging, 15 | WebApiService.Config.App, 16 | Quick.Core.Mvc.Context, 17 | WebApiService.Controller.Home, 18 | WebApiService.Controller.Test; 19 | 20 | type 21 | TStartup = class(TStartupBase) 22 | public 23 | class procedure ConfigureServices(services : TServiceCollection); override; 24 | class procedure Configure(app : TMVCServer); override; 25 | end; 26 | 27 | implementation 28 | 29 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 30 | begin 31 | services 32 | .AddLogging(TLoggerBuilder.GetBuilder//(TLoggerOptionsFormat.ofYAML,False) 33 | .AddConsole(procedure(aOptions : TLoggerConsoleOptions) 34 | begin 35 | aOptions.LogLevel := LOG_DEBUG; 36 | aOptions.ShowEventColors := True; 37 | aOptions.ShowTimeStamp := True; 38 | aOptions.ShowEventType := False; 39 | aOptions.Enabled := True; 40 | end) 41 | .AddFile(procedure(aOptions : TLoggerFileOptions) 42 | begin 43 | aOptions.FileName := '.\WebApiServer.log'; 44 | aOptions.MaxFileSizeInMB := 200; 45 | aOptions.Enabled := True; 46 | end) 47 | .Build 48 | ) 49 | .AddOptions(TOptionsFileFormat.ofJSON,True) 50 | //add entity database 51 | .Extension 52 | .AddDBContext(TDBContextOptionsBuilder.GetBuilder.UseSQLite.ConnectionStringName('ShopContext').Options) 53 | //add response caching 54 | .Extension 55 | .AddResponseCaching 56 | //add memory cache 57 | .Extension 58 | .AddMemoryCache 59 | //configure settings 60 | .Configure(procedure(aOptions : TAppSettings) 61 | begin 62 | aOptions.Smtp := 'mail.domain.com'; 63 | aOptions.Email := 'info@domain.com'; 64 | end) 65 | .Extension.AddAutoMapper; 66 | end; 67 | 68 | class procedure TStartup.Configure(app : TMVCServer); 69 | begin 70 | app 71 | .AddControllers 72 | .AddController(THomeController) 73 | .AddController(TTestController) 74 | //configure routing 75 | //.MapRoute('default',TTestController,'{controller=Test}/{action=Index}/{id?}') 76 | //.MapRoute('HelloWorld',TTestController,'Test/Hello') 77 | //.DefaultRoute(TTestController,'Test/Sum/{number1}/{number2}') 78 | .DefaultRoute(TTestController,'Home/Index') 79 | .UseWebRoot('.\wwwroot') 80 | //.UserHsts 81 | .Extension.UseResponseCaching 82 | .UseStaticFiles 83 | .UseRouting 84 | .Use(function(aContext : THttpContextBase) : Boolean 85 | begin 86 | aContext.Response.Headers.Add('MyHeader','Hello'); 87 | Result := True; 88 | end) 89 | .UseMVC; 90 | end; 91 | 92 | end. 93 | -------------------------------------------------------------------------------- /expert/CoreMvc.StartupCreator.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.StartupCreator; 2 | 3 | interface 4 | 5 | uses 6 | CoreMvc.Wizards.Utils, 7 | ToolsAPI; 8 | 9 | resourcestring 10 | SStartuprResources = 'StartupTemplate'; 11 | SStartupFileName = 'Startup'; 12 | 13 | type 14 | TCoreMvcStartupCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator) 15 | private 16 | fModuleInfo : TModuleInfo; 17 | public 18 | constructor Create(aModuleInfo : TModuleInfo); 19 | // IOTACreator 20 | function GetCreatorType: string; 21 | function GetExisting: Boolean; 22 | function GetFileSystem: string; 23 | function GetOwner: IOTAModule; 24 | function GetUnnamed: Boolean; 25 | // IOTAModuleCreator 26 | function GetAncestorName: string; 27 | function GetImplFileName: string; 28 | function GetIntfFileName: string; 29 | function GetFormName: string; 30 | function GetMainForm: Boolean; 31 | function GetShowForm: Boolean; 32 | function GetShowSource: Boolean; 33 | function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; 34 | function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 35 | function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 36 | procedure FormCreated(const FormEditor: IOTAFormEditor); 37 | end; 38 | 39 | implementation 40 | 41 | uses 42 | System.SysUtils; 43 | 44 | function TCoreMvcStartupCreator.GetCreatorType: string; 45 | begin 46 | Result := sUnit; 47 | end; 48 | 49 | function TCoreMvcStartupCreator.GetExisting: Boolean; 50 | begin 51 | Result := False; 52 | end; 53 | 54 | function TCoreMvcStartupCreator.GetFileSystem: string; 55 | begin 56 | Result := ''; 57 | end; 58 | 59 | function TCoreMvcStartupCreator.GetOwner: IOTAModule; 60 | begin 61 | Result := ActiveProject; 62 | end; 63 | 64 | function TCoreMvcStartupCreator.GetUnnamed: Boolean; 65 | begin 66 | Result := True; 67 | end; 68 | 69 | function TCoreMvcStartupCreator.GetAncestorName: string; 70 | begin 71 | Result := ''; 72 | end; 73 | 74 | function TCoreMvcStartupCreator.GetImplFileName: string; 75 | begin 76 | Result := GetCurrentDir + '\' + SStartupFileName + '.pas'; 77 | end; 78 | 79 | function TCoreMvcStartupCreator.GetIntfFileName: string; 80 | begin 81 | Result := ''; 82 | end; 83 | 84 | function TCoreMvcStartupCreator.GetFormName: string; 85 | begin 86 | Result := ''; 87 | end; 88 | 89 | function TCoreMvcStartupCreator.GetMainForm: Boolean; 90 | begin 91 | Result := False; 92 | end; 93 | 94 | function TCoreMvcStartupCreator.GetShowForm: Boolean; 95 | begin 96 | Result := False; 97 | end; 98 | 99 | function TCoreMvcStartupCreator.GetShowSource: Boolean; 100 | begin 101 | Result := True; 102 | end; 103 | 104 | function TCoreMvcStartupCreator.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; 105 | begin 106 | Result := nil; 107 | end; 108 | 109 | function TCoreMvcStartupCreator.NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 110 | begin 111 | Result := TCoreMvcSourceFile.Create(SStartuprResources,fModuleInfo); 112 | end; 113 | 114 | function TCoreMvcStartupCreator.NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 115 | begin 116 | Result := nil; 117 | end; 118 | 119 | constructor TCoreMvcStartupCreator.Create(aModuleInfo: TModuleInfo); 120 | begin 121 | fModuleInfo := aModuleInfo; 122 | end; 123 | 124 | procedure TCoreMvcStartupCreator.FormCreated(const FormEditor: IOTAFormEditor); 125 | begin 126 | 127 | end; 128 | 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /expert/CoreMvc.ControllerCreator.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.ControllerCreator; 2 | 3 | interface 4 | 5 | uses 6 | CoreMvc.Wizards.Utils, 7 | ToolsAPI; 8 | 9 | resourcestring 10 | SControllerrResources = 'ControllerTemplate'; 11 | SControllerFileName = 'HomeController'; 12 | 13 | type 14 | TCoreMvcControllerCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator) 15 | private 16 | fModuleInfo : TModuleInfo; 17 | public 18 | constructor Create(aModuleInfo : TModuleInfo); 19 | // IOTACreator 20 | function GetCreatorType: string; 21 | function GetExisting: Boolean; 22 | function GetFileSystem: string; 23 | function GetOwner: IOTAModule; 24 | function GetUnnamed: Boolean; 25 | // IOTAModuleCreator 26 | function GetAncestorName: string; 27 | function GetImplFileName: string; 28 | function GetIntfFileName: string; 29 | function GetFormName: string; 30 | function GetMainForm: Boolean; 31 | function GetShowForm: Boolean; 32 | function GetShowSource: Boolean; 33 | function NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; 34 | function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 35 | function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 36 | procedure FormCreated(const FormEditor: IOTAFormEditor); 37 | end; 38 | 39 | implementation 40 | 41 | uses 42 | System.SysUtils; 43 | 44 | function TCoreMvcControllerCreator.GetCreatorType: string; 45 | begin 46 | Result := sUnit; 47 | end; 48 | 49 | function TCoreMvcControllerCreator.GetExisting: Boolean; 50 | begin 51 | Result := False; 52 | end; 53 | 54 | function TCoreMvcControllerCreator.GetFileSystem: string; 55 | begin 56 | Result := ''; 57 | end; 58 | 59 | function TCoreMvcControllerCreator.GetOwner: IOTAModule; 60 | begin 61 | Result := ActiveProject; 62 | end; 63 | 64 | function TCoreMvcControllerCreator.GetUnnamed: Boolean; 65 | begin 66 | Result := True; 67 | end; 68 | 69 | function TCoreMvcControllerCreator.GetAncestorName: string; 70 | begin 71 | Result := ''; 72 | end; 73 | 74 | function TCoreMvcControllerCreator.GetImplFileName: string; 75 | begin 76 | Result := GetCurrentDir + '\' + SControllerFileName + '.pas'; 77 | end; 78 | 79 | function TCoreMvcControllerCreator.GetIntfFileName: string; 80 | begin 81 | Result := ''; 82 | end; 83 | 84 | function TCoreMvcControllerCreator.GetFormName: string; 85 | begin 86 | Result := ''; 87 | end; 88 | 89 | function TCoreMvcControllerCreator.GetMainForm: Boolean; 90 | begin 91 | Result := False; 92 | end; 93 | 94 | function TCoreMvcControllerCreator.GetShowForm: Boolean; 95 | begin 96 | Result := False; 97 | end; 98 | 99 | function TCoreMvcControllerCreator.GetShowSource: Boolean; 100 | begin 101 | Result := True; 102 | end; 103 | 104 | function TCoreMvcControllerCreator.NewFormFile(const FormIdent, AncestorIdent: string): IOTAFile; 105 | begin 106 | Result := nil; 107 | end; 108 | 109 | function TCoreMvcControllerCreator.NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 110 | begin 111 | Result := TCoreMvcSourceFile.Create(SControllerrResources,fModuleInfo); 112 | end; 113 | 114 | function TCoreMvcControllerCreator.NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; 115 | begin 116 | Result := nil; 117 | end; 118 | 119 | constructor TCoreMvcControllerCreator.Create(aModuleInfo : TModuleInfo); 120 | begin 121 | fModuleInfo := aModuleInfo; 122 | end; 123 | 124 | procedure TCoreMvcControllerCreator.FormCreated(const FormEditor: IOTAFormEditor); 125 | begin 126 | 127 | end; 128 | 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /samples/delphi/ApiKeyDatabaseStore/Startup.pas: -------------------------------------------------------------------------------- 1 | unit Startup; 2 | 3 | interface 4 | 5 | uses 6 | Quick.Core.Mvc, 7 | Quick.Core.DependencyInjection, 8 | Quick.Core.Entity.Config, 9 | Quick.Core.Extensions.Caching.Memory, 10 | Quick.Core.Mvc.Extensions.ResponseCaching, 11 | Quick.Core.Extensions.Caching.Redis, 12 | Quick.Core.Extensions.Entity, 13 | Quick.Core.Extensions.AutoMapper, 14 | Quick.Core.Logging, 15 | Quick.Core.Mvc.Context, 16 | Quick.Core.Identity, 17 | Quick.Core.Security.Claims, 18 | Quick.Core.Security.Authorization, 19 | Quick.Core.Extensions.Authentication, 20 | Quick.Core.Extensions.Authorization, 21 | Quick.Core.Extensions.Authentication.ApiKey, 22 | Infra.Data.DBContext.Shop, 23 | Infra.Data.Models.Product, 24 | Infra.Data.Models.Costumer, 25 | Infra.Data.Identities, 26 | Controller.Home; 27 | 28 | type 29 | TStartup = class(TStartupMvc) 30 | public 31 | class procedure ConfigureServices(services : TServiceCollection); override; 32 | class procedure Configure(app : TMVCServer); override; 33 | end; 34 | 35 | implementation 36 | 37 | class procedure TStartup.ConfigureServices(services : TServiceCollection); 38 | begin 39 | services 40 | .AddLogging(TLoggerBuilder.GetBuilder(TLoggerOptionsFormat.ofYAML,False) 41 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 42 | begin 43 | aOptions.LogLevel := LOG_DEBUG; 44 | aOptions.ShowEventColors := True; 45 | aOptions.ShowTimeStamp := True; 46 | aOptions.ShowEventType := False; 47 | aOptions.Enabled := True; 48 | end) 49 | .AddFile(procedure(aOptions : TFileLoggerOptions) 50 | begin 51 | aOptions.FileName := '.\WebApiServer.log'; 52 | aOptions.MaxFileSizeInMB := 200; 53 | aOptions.Enabled := True; 54 | end) 55 | .Build 56 | ) 57 | .AddDebugger 58 | .AddOptions(TOptionsFileFormat.ofYAML,True) 59 | //add entity database 60 | .Extension 61 | .AddDBContext(TDBContextOptionsBuilder.GetBuilder.UseSQLite.ConnectionStringName('ShopContext').Options) 62 | //add Identity 63 | .Extension() 64 | .AddIdentity(procedure(aOptions : TIdentityOptions) 65 | begin 66 | aOptions.Password.RequiredLength := 6; 67 | aOptions.User.RequireUniqueEmail := True; 68 | end) 69 | .AddEntityStore(); 70 | //add Authentication 71 | services.Extension() 72 | .AddAuthentication(procedure(aOptions : TAuthenticationOptions) 73 | begin 74 | 75 | end); 76 | //add ApiKey Authentication 77 | services.Extension 78 | .AddApiKey() 79 | .UseIdentityStore('ApiKey'); 80 | //add Authorization 81 | services.Extension 82 | .AddAuthorization(procedure(aOptions : TAuthorizationOptions) 83 | begin 84 | aOptions.AddPolicy('ApiKeyValidation',TAuthorizationPolicyBuilder.GetBuilder 85 | .RequireAuthenticatedUser.Build 86 | //.RequireClaim(TClaimTypes.Role,'Admin').Build 87 | ); 88 | end); 89 | end; 90 | 91 | class procedure TStartup.Configure(app : TMVCServer); 92 | begin 93 | app 94 | .AddControllers 95 | .AddController(THomeController) 96 | .DefaultRoute(THomeController,'Home/Index') 97 | .UseWebRoot('.\wwwroot') 98 | .UseStaticFiles 99 | .UseRouting 100 | .UseAuthentication 101 | .UseAuthorization 102 | .UseMustachePages 103 | .UseMVC; 104 | end; 105 | 106 | end. 107 | -------------------------------------------------------------------------------- /expert/CoreMvc.Wizards.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.Wizards; 2 | 3 | interface 4 | 5 | uses 6 | ToolsAPI, 7 | CoreMvc.Wizards.Utils, 8 | CoreMvc.Wizard.MainForm; 9 | 10 | resourcestring 11 | SGalleryCategory = 'Quick Core'; 12 | SIDString = 'Quick.Core.Mvc.Wizard.Server'; 13 | 14 | type 15 | TCoreMvcProjectWizard = class(TNotifierObject, IOTAWizard, IOTARepositoryWizard, IOTARepositoryWizard60, 16 | IOTARepositoryWizard80, IOTAProjectWizard, IOTAProjectWizard100) 17 | private 18 | fProjectWizardInfo : TProjectWizardInfo; 19 | public 20 | constructor Create; 21 | // IOTAWizard 22 | procedure Execute; 23 | procedure AfterSave; 24 | procedure BeforeSave; 25 | procedure Destroyed; 26 | procedure Modified; 27 | function GetIDString: string; 28 | function GetName: string; 29 | function GetState: TWizardState; 30 | // IOTARepositoryWizard 31 | function GetAuthor: string; 32 | function GetComment: string; 33 | function GetGlyph: Cardinal; 34 | function GetPage: string; 35 | // IOTARepositoryWizard60 36 | function GetDesigner: string; 37 | // IOTARepositoryWizard80 38 | function GetGalleryCategory: IOTAGalleryCategory; 39 | function GetPersonality: string; 40 | // IOTAProjectWizard100 41 | function IsVisible(Project: IOTAProject): Boolean; 42 | end; 43 | 44 | procedure Register; 45 | 46 | implementation 47 | 48 | uses 49 | CoreMvc.ProjectCreator; 50 | 51 | { TCoreMvcProjectWizard } 52 | 53 | constructor TCoreMvcProjectWizard.Create; 54 | var 55 | LCategoryServices: IOTAGalleryCategoryManager; 56 | begin 57 | inherited Create; 58 | LCategoryServices := BorlandIDEServices as IOTAGalleryCategoryManager; 59 | LCategoryServices.AddCategory(LCategoryServices.FindCategory(sCategoryRoot), SIDString, SGalleryCategory); 60 | end; 61 | 62 | procedure TCoreMvcProjectWizard.Execute; 63 | begin 64 | if TfrmProjectWizard.Execute(fProjectWizardInfo) then (BorlandIDEServices as IOTAModuleServices).CreateModule(TCoreMvcProjectCreator.Create(fProjectWizardInfo)); 65 | end; 66 | 67 | function TCoreMvcProjectWizard.GetIDString: string; 68 | begin 69 | Result := SIDString; 70 | end; 71 | 72 | function TCoreMvcProjectWizard.GetName: string; 73 | begin 74 | Result := 'Quick Core Mvc Wizard'; 75 | end; 76 | 77 | function TCoreMvcProjectWizard.GetState: TWizardState; 78 | begin 79 | Result := [wsEnabled]; 80 | end; 81 | 82 | procedure TCoreMvcProjectWizard.AfterSave; 83 | begin 84 | end; 85 | 86 | procedure TCoreMvcProjectWizard.BeforeSave; 87 | begin 88 | end; 89 | 90 | procedure TCoreMvcProjectWizard.Destroyed; 91 | begin 92 | end; 93 | 94 | procedure TCoreMvcProjectWizard.Modified; 95 | begin 96 | end; 97 | 98 | function TCoreMvcProjectWizard.GetAuthor: string; 99 | begin 100 | Result := 'Exilon Soft'; 101 | end; 102 | 103 | function TCoreMvcProjectWizard.GetComment: string; 104 | begin 105 | Result := 'Creates a MVC Project'; 106 | end; 107 | 108 | function TCoreMvcProjectWizard.GetGlyph: Cardinal; 109 | begin 110 | Result := 0; 111 | end; 112 | 113 | function TCoreMvcProjectWizard.GetPage: string; 114 | begin 115 | Result := SGalleryCategory; 116 | end; 117 | 118 | function TCoreMvcProjectWizard.GetDesigner: string; 119 | begin 120 | Result := dAny; 121 | end; 122 | 123 | function TCoreMvcProjectWizard.GetGalleryCategory: IOTAGalleryCategory; 124 | begin 125 | Result := (BorlandIDEServices as IOTAGalleryCategoryManager).FindCategory(SIDString); 126 | end; 127 | 128 | function TCoreMvcProjectWizard.GetPersonality: string; 129 | begin 130 | Result := sDelphiPersonality; 131 | end; 132 | 133 | function TCoreMvcProjectWizard.IsVisible(Project: IOTAProject): Boolean; 134 | begin 135 | Result := True; 136 | end; 137 | 138 | procedure Register; 139 | begin 140 | RegisterPackageWizard(TCoreMvcProjectWizard.Create); 141 | end; 142 | 143 | 144 | end. 145 | -------------------------------------------------------------------------------- /expert/CoreMvc.ProjectCreator.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.ProjectCreator; 2 | 3 | interface 4 | 5 | uses 6 | ToolsAPI, 7 | PlatformAPI, 8 | System.SysUtils, 9 | System.Types, 10 | System.Classes, 11 | CoreMvc.Wizards.Utils; 12 | 13 | resourcestring 14 | SCoreMvcProject = 'ProjectTemplate'; 15 | 16 | type 17 | TCoreMvcProjectCreator = class(TInterfacedObject, IOTACreator, IOTAProjectCreator50, IOTAProjectCreator80,IOTAProjectCreator160, IOTAProjectCreator) 18 | private 19 | fProjectWizardInfo : TProjectWizardInfo; 20 | public 21 | constructor Create(aProjectWizardInfo : TProjectWizardInfo); 22 | // IOTACreator 23 | function GetCreatorType: string; 24 | function GetExisting: Boolean; 25 | function GetFileSystem: string; 26 | function GetOwner: IOTAModule; 27 | function GetUnnamed: Boolean; 28 | // IOTAProjectCreator 29 | function GetFileName: string; 30 | function GetOptionFileName: string; deprecated; 31 | function GetShowSource: Boolean; 32 | procedure NewDefaultModule; deprecated; 33 | function NewOptionSource(const ProjectName: string): IOTAFile; deprecated; 34 | procedure NewProjectResource(const Project: IOTAProject); 35 | function NewProjectSource(const ProjectName: string): IOTAFile; 36 | // IOTAProjectCreator50 37 | procedure NewDefaultProjectModule(const Project: IOTAProject); 38 | // IOTAProjectCreator80 39 | function GetProjectPersonality: string; 40 | // IOTAProjectCreator160 41 | function GetFrameworkType: string; 42 | function GetPlatforms: TArray; 43 | function GetPreferredPlatform: string; 44 | procedure SetInitialOptions(const NewProject: IOTAProject); 45 | end; 46 | 47 | implementation 48 | 49 | uses 50 | CoreMvc.ControllerCreator, 51 | CoreMvc.StartupCreator; 52 | 53 | constructor TCoreMvcProjectCreator.Create(aProjectWizardInfo: TProjectWizardInfo); 54 | begin 55 | fProjectWizardInfo := aProjectWizardInfo; 56 | end; 57 | 58 | function TCoreMvcProjectCreator.GetCreatorType: string; 59 | begin 60 | Result := ''; 61 | end; 62 | 63 | function TCoreMvcProjectCreator.GetExisting: Boolean; 64 | begin 65 | Result := False; 66 | end; 67 | 68 | function TCoreMvcProjectCreator.GetFileSystem: string; 69 | begin 70 | Result := ''; 71 | end; 72 | 73 | function TCoreMvcProjectCreator.GetOwner: IOTAModule; 74 | begin 75 | Result := ActiveProjectGroup; 76 | end; 77 | 78 | function TCoreMvcProjectCreator.GetUnnamed: Boolean; 79 | begin 80 | Result := True; 81 | end; 82 | 83 | function TCoreMvcProjectCreator.GetFileName: string; 84 | begin 85 | Result := GetCurrentDir + '\CoreMVCProject.dpr'; 86 | end; 87 | 88 | function TCoreMvcProjectCreator.GetOptionFileName: string; deprecated; 89 | begin 90 | Result := ''; 91 | end; 92 | 93 | function TCoreMvcProjectCreator.GetShowSource: Boolean; 94 | begin 95 | Result := True; 96 | end; 97 | 98 | function TCoreMvcProjectCreator.NewProjectSource(const ProjectName: string): IOTAFile; 99 | var 100 | moduleInfo : TModuleInfo; 101 | begin 102 | moduleInfo.ProjectName := ProjectName; 103 | Result := TCoreMvcSourceFile.Create(SCoreMvcProject,moduleInfo); 104 | end; 105 | 106 | function TCoreMvcProjectCreator.NewOptionSource(const ProjectName: string): IOTAFile; deprecated; 107 | begin 108 | Result := nil; 109 | end; 110 | 111 | procedure TCoreMvcProjectCreator.NewDefaultModule; deprecated; 112 | begin 113 | end; 114 | 115 | procedure TCoreMvcProjectCreator.NewProjectResource(const Project: IOTAProject); 116 | begin 117 | end; 118 | 119 | procedure TCoreMvcProjectCreator.NewDefaultProjectModule(const Project: IOTAProject); 120 | var 121 | ms: IOTAModuleServices; 122 | begin 123 | ms := BorlandIDEServices as IOTAModuleServices; 124 | ms.CreateModule(TCoreMvcControllerCreator.Create(fProjectWizardInfo.ControllerInfo)); 125 | ms.CreateModule(TCoreMvcStartupCreator.Create(fProjectWizardInfo.StartupInfo)); 126 | end; 127 | 128 | function TCoreMvcProjectCreator.GetProjectPersonality: string; 129 | begin 130 | Result := sDelphiPersonality; 131 | end; 132 | 133 | function TCoreMvcProjectCreator.GetFrameworkType: string; 134 | begin 135 | Result := sFrameworkTypeVCL; 136 | end; 137 | 138 | function TCoreMvcProjectCreator.GetPlatforms: TArray; 139 | begin 140 | SetLength(Result, 2); 141 | Result[0] := cWin32Platform; 142 | Result[1] := cWin64Platform; 143 | //Result[2] := cLinux64Platform; 144 | end; 145 | 146 | function TCoreMvcProjectCreator.GetPreferredPlatform: string; 147 | begin 148 | Result := cWin64Platform; 149 | end; 150 | 151 | procedure TCoreMvcProjectCreator.SetInitialOptions(const NewProject: IOTAProject); 152 | begin 153 | end; 154 | 155 | end. 156 | -------------------------------------------------------------------------------- /expert/CoreMvc.Wizard.MainForm.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.Wizard.MainForm; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, 8 | CoreMvc.Wizards.Utils, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.ComCtrls, 9 | Vcl.Imaging.pngimage, Vcl.CheckLst, Vcl.Buttons; 10 | 11 | type 12 | TfrmProjectWizard = class(TForm) 13 | btnOk: TButton; 14 | btnCancel: TButton; 15 | paBottom: TPanel; 16 | pageMain: TPageControl; 17 | tabExtensions: TTabSheet; 18 | imgLogo: TImage; 19 | tabServer: TTabSheet; 20 | Label1: TLabel; 21 | Label5: TLabel; 22 | Label6: TLabel; 23 | edProjectPath: TEdit; 24 | edProjectName: TEdit; 25 | btnBrowseProjectPath: TButton; 26 | cxCreateProjectDirectory: TCheckBox; 27 | paTitlebar: TPanel; 28 | paMain: TPanel; 29 | meProjecTypetInfo: TMemo; 30 | lvProjectType: TListView; 31 | lvMiddlewares: TListView; 32 | lvServices: TListView; 33 | btnBack: TButton; 34 | paLogo: TPanel; 35 | udServices: TUpDown; 36 | udMiddlewares: TUpDown; 37 | Label2: TLabel; 38 | procedure FormCreate(Sender: TObject); 39 | procedure OnParametersChange(Sender: TObject); 40 | procedure btnOkClick(Sender: TObject); 41 | procedure btnBackClick(Sender: TObject); 42 | procedure udServicesClick(Sender: TObject; Button: TUDBtnType); 43 | procedure udMiddlewaresClick(Sender: TObject; Button: TUDBtnType); 44 | private 45 | { Private declarations } 46 | fProjectWizardInfo : TProjectWizardInfo; 47 | procedure ValidateParameters; 48 | procedure ExchangeItems(lv: TListView; const i, j: Integer); 49 | public 50 | { Public declarations } 51 | class function Execute(var ProjectWizardInfo : TProjectWizardInfo) : Boolean; 52 | end; 53 | 54 | var 55 | frmProjectWizard: TfrmProjectWizard; 56 | 57 | implementation 58 | 59 | {$R *.dfm} 60 | 61 | procedure TfrmProjectWizard.ExchangeItems(lv: TListView; const i, j: Integer); 62 | var 63 | tempLI: TListItem; 64 | begin 65 | lv.Items.BeginUpdate; 66 | try 67 | tempLI := TListItem.Create(lv.Items); 68 | tempLI.Assign(lv.Items.Item[i]); 69 | lv.Items.Item[i].Assign(lv.Items.Item[j]); 70 | lv.Items.Item[j].Assign(tempLI); 71 | tempLI.Free; 72 | finally 73 | lv.Items.EndUpdate 74 | end; 75 | end; 76 | 77 | procedure TfrmProjectWizard.OnParametersChange(Sender: TObject); 78 | begin 79 | ValidateParameters; 80 | end; 81 | 82 | procedure TfrmProjectWizard.udMiddlewaresClick(Sender: TObject; Button: TUDBtnType); 83 | var 84 | idx : Integer; 85 | begin 86 | idx := lvMiddlewares.ItemIndex; 87 | if idx = -1 then Exit; 88 | if (Button = TUDBtnType.btPrev) and (idx >= 0) and (idx < lvMiddlewares.Items.Count - 1) then 89 | begin 90 | ExchangeItems(lvMiddlewares,idx, idx + 1); 91 | lvMiddlewares.Items[idx + 1].Selected := True; 92 | end 93 | else 94 | if (Button = TUDBtnType.btNext) and (idx > 0) and (idx < lvMiddlewares.Items.Count) then 95 | begin 96 | ExchangeItems(lvMiddlewares,idx, idx - 1); 97 | lvMiddlewares.Items[idx - 1].Selected := True; 98 | end; 99 | end; 100 | procedure TfrmProjectWizard.udServicesClick(Sender: TObject; Button: TUDBtnType); 101 | var 102 | idx : Integer; 103 | begin 104 | idx := lvServices.ItemIndex; 105 | if idx = -1 then Exit; 106 | if (Button = TUDBtnType.btPrev) and (idx >= 0) and (idx < lvServices.Items.Count - 1) then 107 | begin 108 | ExchangeItems(lvServices,idx, idx + 1); 109 | lvServices.Items[idx + 1].Selected := True; 110 | end 111 | else 112 | if (Button = TUDBtnType.btNext) and (idx > 0) and (idx < lvServices.Items.Count) then 113 | begin 114 | ExchangeItems(lvServices,idx, idx - 1); 115 | lvServices.Items[idx - 1].Selected := True; 116 | end; 117 | end; 118 | 119 | procedure TfrmProjectWizard.btnBackClick(Sender: TObject); 120 | begin 121 | btnOk.Caption := 'Next'; 122 | pageMain.ActivePage := tabServer; 123 | btnBack.Visible := False; 124 | end; 125 | 126 | procedure TfrmProjectWizard.btnOkClick(Sender: TObject); 127 | begin 128 | if btnOk.Caption = 'Next' then 129 | begin 130 | btnOk.Caption := 'Create'; 131 | pageMain.ActivePage := tabExtensions; 132 | btnBack.Visible := True; 133 | end 134 | else ModalResult := mrOk; 135 | end; 136 | 137 | class function TfrmProjectWizard.Execute(var ProjectWizardInfo: TProjectWizardInfo): Boolean; 138 | begin 139 | Result := False; 140 | with TfrmProjectWizard.Create(nil) do 141 | begin 142 | fProjectWizardInfo := ProjectWizardInfo; 143 | if ShowModal = mrOk then 144 | begin 145 | //set project info 146 | if cxCreateProjectDirectory.Checked then edProjectPath.Text := edProjectPath.Text + '\' + edProjectName.Text; 147 | fProjectWizardInfo.ProjectName := edProjectName.Text; 148 | fProjectWizardInfo.ProjectType := TProjectType(lvProjectType.ItemIndex); 149 | ForceDirectories(edProjectPath.Text); 150 | SetCurrentDir(edProjectPath.Text); 151 | //set startup info 152 | fProjectWizardInfo.StartupInfo.ModuleName := 'Startup'; 153 | //set controllerinfo 154 | fProjectWizardInfo.ControllerInfo.ModuleName := 'HomeController2'; 155 | Result := True; 156 | end; 157 | end; 158 | end; 159 | 160 | 161 | procedure TfrmProjectWizard.FormCreate(Sender: TObject); 162 | begin 163 | pageMain.Pages[0].TabVisible := False; 164 | pageMain.Pages[1].TabVisible := False; 165 | pageMain.ActivePage := tabServer; 166 | lvProjectType.ItemIndex := 0; 167 | lvServices.Column[2].Width := 0; 168 | lvMiddlewares.Column[2].Width := 0; 169 | edProjectPath.Text := GetEnvironmentVariable('BDSPROJECTSDIR'); 170 | end; 171 | 172 | procedure TfrmProjectWizard.ValidateParameters; 173 | begin 174 | btnOk.Enabled := (edProjectName.Text <> '') and (edProjectPath.Text <> ''); 175 | end; 176 | 177 | end. 178 | -------------------------------------------------------------------------------- /QuickCore.inc: -------------------------------------------------------------------------------- 1 | { 2 | This file is part of QuickCore: https://github.com/exilon/QuickCore 3 | 4 | QuickCore. Copyright (C) 2024 Kike Pérez 5 | Exilon - https://www.exilon.es 6 | 7 | *************************************************************************** 8 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); 10 | you may not use this file except in compliance with the License. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. 20 | 21 | *************************************************************************** 22 | } 23 | 24 | {$ifdef FPC} 25 | {$MODE DELPHI} 26 | 27 | {$INLINE ON} 28 | {$define HASINLINE} 29 | 30 | {$ifdef LINUX} 31 | {$define FPCLINUX} 32 | {$endif} 33 | 34 | {$ifdef ANDROID} 35 | {$define LINUX} 36 | {$endif} 37 | 38 | {$ifdef VER2_7} 39 | {$define ISFPC27} 40 | {$endif} 41 | 42 | {$ifdef VER3_0} 43 | {$define ISFPC27} 44 | {$define ISFPC30} 45 | {$endif} 46 | 47 | {$ifdef VER3_1} 48 | {$define ISFPC27} 49 | {$define ISFPC30} 50 | {$endif} 51 | 52 | {$ifdef FPC_REQUIRES_PROPER_ALIGNMENT} 53 | {$define FPC_ENUMHASINNER} 54 | {$endif} 55 | 56 | {$ifdef FPC_HAS_MANAGEMENT_OPERATORS} 57 | {$define ISDELPHI2006ANDUP} 58 | {$endif FPC_HAS_MANAGEMENT_OPERATORS} 59 | 60 | {$else FPC} 61 | 62 | {$ifdef CONDITIONALEXPRESSIONS} //Delphi 6 or newer 63 | {$define HASINTERFACERTTI} //interface RTTI (not FPC) 64 | {$ifndef LINUX} 65 | {$ifdef VER140} 66 | {$define DELPHI6_UP} //Delphi 6 or newer 67 | {$else} 68 | {$define DELPHI7_UP} //Delphi 7 or newer 69 | {$endif} 70 | {$endif LINUX} 71 | {$if CompilerVersion >= 17} 72 | {$define DELPHI2005_UP} //Delphi 2005 or newer 73 | {$ifend} 74 | {$if CompilerVersion >= 18} 75 | {$define DELPHI2006_UP} //Delphi 2006 or newer 76 | {$define HASINLINE} 77 | {$ifend} 78 | {$if CompilerVersion > 18} 79 | {$define DELPHI2007_UP} //Delphi 2007 or newer 80 | {$ifend} 81 | {$if CompilerVersion = 20} 82 | {$define DELPHI2009_UP} //Delphi 2009 83 | {$ifend} 84 | {$if CompilerVersion >= 21.0} //Delphi 2010 85 | {$define DELPHI2010_UP} 86 | {$define FPC_OR_UNICODE} 87 | {$ifend} 88 | {$if CompilerVersion >= 22.0} //Delphi XE 89 | {$define DELPHIXE_UP} 90 | {$ifend} 91 | {$if CompilerVersion >= 23.0} //Delphi XE2 92 | {$define DELPHIXE2_UP} 93 | {$ifend} 94 | {$if CompilerVersion >= 24.0} //Delphi XE3 95 | {$define DELPHIXE3_UP} 96 | {$ifend} 97 | {$if CompilerVersion >= 25.0} //Delphi XE4 98 | {$define DELPHIXE4_UP} 99 | {$ifend} 100 | {$if CompilerVersion >= 26.0} //Delphi XE5 101 | {$define DELPHIXE5_UP} 102 | {$ifend} 103 | {$if CompilerVersion >= 27.0} //Delphi XE6 104 | {$define DELPHIXE6_UP} 105 | {$ifend} 106 | {$if CompilerVersion >= 28.0} //Delphi XE7 107 | {$define DELPHIXE7_UP} 108 | {$ifend} 109 | {$if CompilerVersion >= 29.0} //Delphi XE8 110 | {$define DELPHIXE8_UP} 111 | {$ifend} 112 | {$if CompilerVersion >= 30.0} //Delphi XE10 Seattle 113 | {$define DELPHIRX10_UP} 114 | {$define DELPHISEATTLE_UP} 115 | {$ifend} 116 | {$if CompilerVersion >= 31.0} //Delphi RX10.1 Berlin 117 | {$define DELPHIRX101_UP} 118 | {$define DELPHIBERLIN_UP} 119 | {$ifend} 120 | {$if CompilerVersion >= 32.0} //Delphi RX10.2 Tokyo 121 | {$define DELPHIRX102_UP} 122 | {$define DELPHITOKYO_UP} 123 | {$ifdef LINUX} 124 | {$define DELPHILINUX} 125 | {$ifend} 126 | {$ifend} 127 | {$if CompilerVersion >= 33.0} //Delphi RX10.3 Rio 128 | {$define DELPHIRX103_UP} 129 | {$define DELPHIRIO_UP} 130 | {$ifend} 131 | {$if CompilerVersion >= 34.0} //Delphi RX10.4 Sydney 132 | {$define DELPHIRX104_UP} 133 | {$define DELPHISYDNEY_UP} 134 | {$ifend} 135 | {$if CompilerVersion >= 35.0} //Delphi RX11 Alexandria 136 | {$define DELPHIRX11_UP} 137 | {$define DELPHIALEXANDRIA_UP} 138 | {$if defined(ANDROID) OR defined(IOS)} 139 | {$define NEXTGEN} //compatibility with older delphis 140 | {$endif} 141 | {$ifend} 142 | {$if CompilerVersion >= 36.0} //Delphi RX12 Athens 143 | {$define DELPHIRX12_UP} 144 | {$define DELPHIATHENS_UP} 145 | {$if defined(ANDROID) OR defined(IOS)} 146 | {$define NEXTGEN} //compatibility with older delphis 147 | {$endif} 148 | {$ifend} 149 | {$else} 150 | //Delphi 5 or older 151 | {$define DELPHI6OROLDER} 152 | {$define DELPHI5OROLDER} 153 | {$define DELPHI5ORFPC} 154 | {$define MSWINDOWS} 155 | {$endif} 156 | 157 | {$endif FPC} 158 | 159 | {$ifdef VER150} 160 | {$WARN SYMBOL_DEPRECATED OFF} 161 | {$WARN UNSAFE_TYPE OFF} 162 | {$WARN UNSAFE_CODE OFF} 163 | {$WARN UNSAFE_CAST OFF} 164 | {$ENDIF} 165 | 166 | {$ifdef CONDITIONALEXPRESSIONS} //Delphi 6 or newer 167 | {.$WARN SYMBOL_PLATFORM OFF} 168 | {.$WARN UNIT_PLATFORM OFF} 169 | {$endif} 170 | 171 | {.$define SHOW_ENVIRONMENTPATH_ERRORS} 172 | 173 | //format params as TValue 174 | {$DEFINE VALUE_FORMATPARAMS} 175 | {$DEFINE FIREDAC_SHOW_WAITCURSOR} 176 | 177 | //Debug library 178 | {$IFDEF DEBUG} 179 | {.$DEFINE DEBUG_LIB} 180 | {.$DEFINE DEBUG_HANDLEDEXCEPTIONS} 181 | {.$DEFINE DEBUG_ROUTING} 182 | {.$DEFINE DEBUG_HTTPCONTEXT} 183 | {.$DEFINE DEBUG_AUTENTICATION} 184 | {.$DEFINE DEBUG_MAPPER} 185 | {.$DEFINE DEBUG_ENTITY} 186 | {.$DEFINE DEBUG_DI} 187 | {.$DEFINE DEBUG_CONTROLLER} 188 | {.$DEFINE DEBUG_MSQ} 189 | {.$DEFINE DEBUG_LOGGING} 190 | {.$DEFINE DEBUG_HEALTHCHECKS} 191 | {$ENDIF} 192 | 193 | -------------------------------------------------------------------------------- /expert/CoreMvc.Wizards.Utils.pas: -------------------------------------------------------------------------------- 1 | unit CoreMvc.Wizards.Utils; 2 | 3 | interface 4 | 5 | uses 6 | System.Types, 7 | System.SysUtils, 8 | System.Classes, 9 | ToolsAPI, 10 | Quick.Commons; 11 | 12 | type 13 | TModuleInfo = record 14 | ProjectName : string; 15 | ModuleName : string; 16 | UsesClause : TArray; 17 | VarDeclar : TArray; 18 | CodePart1 : TArray; 19 | CodePart2 : TArray; 20 | InitSection : TArray; 21 | FinalizeSection : TArray; 22 | end; 23 | 24 | TCoreMvcSourceFile = class(TInterfacedObject, IOTAFile) 25 | strict private 26 | fResourceName: string; 27 | fModuleInfo : TModuleInfo; 28 | strict protected 29 | property ResourceName: string read fResourceName; 30 | public 31 | constructor Create(const aResourceName: string; aModuleInfo : TModuleInfo); 32 | function GetAge: TDateTime; virtual; 33 | function GetSource: string; virtual; 34 | end; 35 | 36 | TProjectType = (ptMVCServer, ptWebApi); 37 | 38 | TProjectWizardInfo = record 39 | ProjectName : string; 40 | ProjectType : TProjectType; 41 | ControllerInfo : TModuleInfo; 42 | StartupInfo : TModuleInfo; 43 | end; 44 | 45 | function ActiveProjectGroup: IOTAProjectGroup; 46 | function ActiveProject: IOTAProject; 47 | function ProjectModule(const Project: IOTAProject): IOTAModule; 48 | function ActiveSourceEditor: IOTASourceEditor; 49 | function SourceEditor(const Module: IOTAModule): IOTASourceEditor; 50 | function EditorAsString(const SourceEditor: IOTASourceEditor): string; 51 | 52 | implementation 53 | 54 | function ActiveProjectGroup: IOTAProjectGroup; 55 | var 56 | I: Integer; 57 | AModuleServices: IOTAModuleServices; 58 | AModule: IOTAModule; 59 | AProjectGroup: IOTAProjectGroup; 60 | begin 61 | Result := NIL; 62 | AModuleServices := BorlandIDEServices as IOTAModuleServices; 63 | for I := 0 to AModuleServices.ModuleCount - 1 do 64 | begin 65 | AModule := AModuleServices.Modules[I]; 66 | if AModule.QueryInterface(IOTAProjectGroup, AProjectGroup) = S_OK then 67 | Break; 68 | end; 69 | Result := AProjectGroup; 70 | end; 71 | 72 | function ActiveProject: IOTAProject; 73 | var 74 | PG: IOTAProjectGroup; 75 | begin 76 | PG := ActiveProjectGroup; 77 | if PG <> NIL then 78 | Result := PG.ActiveProject; 79 | end; 80 | 81 | function ProjectModule(const Project: IOTAProject): IOTAModule; 82 | var 83 | I: Integer; 84 | AModuleServices: IOTAModuleServices; 85 | AModule: IOTAModule; 86 | AProject: IOTAProject; 87 | begin 88 | Result := NIL; 89 | AModuleServices := BorlandIDEServices as IOTAModuleServices; 90 | for I := 0 to AModuleServices.ModuleCount - 1 do 91 | begin 92 | AModule := AModuleServices.Modules[I]; 93 | if (AModule.QueryInterface(IOTAProject, AProject) = S_OK) and (Project = AProject) then 94 | Break; 95 | end; 96 | Result := AProject; 97 | end; 98 | 99 | function SourceEditor(const Module: IOTAModule): IOTASourceEditor; 100 | var 101 | I, LFileCount: Integer; 102 | begin 103 | Result := NIL; 104 | if Module = NIL then 105 | Exit; 106 | 107 | LFileCount := Module.GetModuleFileCount; 108 | for I := 0 to LFileCount - 1 do 109 | begin 110 | if Module.GetModuleFileEditor(I).QueryInterface(IOTASourceEditor, Result) = S_OK then 111 | Break; 112 | end; 113 | end; 114 | 115 | function ActiveSourceEditor: IOTASourceEditor; 116 | var 117 | CM: IOTAModule; 118 | begin 119 | Result := NIL; 120 | if BorlandIDEServices = NIL then 121 | Exit; 122 | 123 | CM := (BorlandIDEServices as IOTAModuleServices).CurrentModule; 124 | Result := SourceEditor(CM); 125 | end; 126 | 127 | function EditorAsString(const SourceEditor: IOTASourceEditor): string; 128 | Const 129 | iBufferSize: Integer = 1024; 130 | var 131 | Reader: IOTAEditReader; 132 | iPosition, iRead: Integer; 133 | strBuffer: AnsiString; 134 | begin 135 | Result := ''; 136 | Reader := SourceEditor.CreateReader; 137 | try 138 | iPosition := 0; 139 | repeat 140 | SetLength(strBuffer, iBufferSize); 141 | iRead := Reader.GetText(iPosition, PAnsiChar(strBuffer), iBufferSize); 142 | SetLength(strBuffer, iRead); 143 | Result := Result + string(strBuffer); 144 | Inc(iPosition, iRead); 145 | until iRead < iBufferSize; 146 | finally 147 | Reader := NIL; 148 | end; 149 | end; 150 | 151 | {$REGION 'TWiRLSourceFile'} 152 | 153 | constructor TCoreMvcSourceFile.Create(const aResourceName: string; aModuleInfo : TModuleInfo); 154 | begin 155 | inherited Create; 156 | fResourceName := aResourceName; 157 | fModuleInfo := aModuleInfo; 158 | end; 159 | 160 | function TCoreMvcSourceFile.GetAge: TDateTime; 161 | begin 162 | Result := -1; 163 | end; 164 | 165 | function TCoreMvcSourceFile.GetSource: string; 166 | var 167 | Res: TResourceStream; 168 | S: TStrings; 169 | begin 170 | Res := TResourceStream.Create(HInstance, ResourceName, RT_RCDATA); 171 | try 172 | if Res.Size = 0 then 173 | raise Exception.CreateFmt('Resource %s is empty', [ResourceName]); 174 | 175 | S := TStringList.Create; 176 | try 177 | Res.Position := 0; 178 | S.LoadFromStream(Res); 179 | Result := s.Text; 180 | Result := StringReplace(Result,'{%PROJECTNAME%}',fModuleInfo.ProjectName,[rfIgnoreCase,rfReplaceAll]); 181 | Result := StringReplace(Result,'{%MODULENAME%}',fModuleInfo.ModuleName,[rfIgnoreCase,rfReplaceAll]); 182 | Result := StringReplace(Result,'{%USES%}',CommaText(fModuleInfo.UsesClause),[rfIgnoreCase,rfReplaceAll]); 183 | Result := StringReplace(Result,'{%VAR%}',CommaText(fModuleInfo.VarDeclar),[rfIgnoreCase,rfReplaceAll]); 184 | Result := StringReplace(Result,'{%CODE1%}',ArrayToString(fModuleInfo.CodePart1),[rfIgnoreCase,rfReplaceAll]); 185 | Result := StringReplace(Result,'{%CODE2%}',ArrayToString(fModuleInfo.CodePart2),[rfIgnoreCase,rfReplaceAll]); 186 | Result := StringReplace(Result,'{%INITIALIZATION%}',ArrayToString(fModuleInfo.InitSection),[rfIgnoreCase,rfReplaceAll]); 187 | Result := StringReplace(Result,'{%FINALIZATION%}',ArrayToString(fModuleInfo.FinalizeSection),[rfIgnoreCase,rfReplaceAll]); 188 | finally 189 | S.Free; 190 | end; 191 | finally 192 | Res.Free; 193 | end; 194 | end; 195 | 196 | {$ENDREGION} 197 | 198 | end. 199 | -------------------------------------------------------------------------------- /samples/delphi/TaskControlServer/bin/Win64/Debug/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Queues - TaskControl 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 74 | 75 | 76 | 137 |
138 | 139 | 152 | 153 |
156 |
157 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /samples/delphi/RestClient-Server/Server/RestServer.dpr: -------------------------------------------------------------------------------- 1 | program RestServer; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | System.SysUtils, 9 | Quick.Commons, 10 | Quick.Console, 11 | Quick.AppService, 12 | Quick.Core.DependencyInjection in '..\..\..\..\Quick.Core.DependencyInjection.pas', 13 | Quick.Core.Extensions.Caching.Memory in '..\..\..\..\Quick.Core.Extensions.Caching.Memory.pas', 14 | Quick.Core.Mvc in '..\..\..\..\Quick.Core.Mvc.pas', 15 | Quick.Core.Entity in '..\..\..\..\Quick.Core.Entity.pas', 16 | Quick.Core.Serializer in '..\..\..\..\Quick.Core.Serializer.pas', 17 | Quick.Core.Mvc.Routing in '..\..\..\..\Quick.Core.Mvc.Routing.pas', 18 | Quick.Core.Mvc.WebApi in '..\..\..\..\Quick.Core.Mvc.WebApi.pas', 19 | Quick.Core.Mvc.ActionInvoker in '..\..\..\..\Quick.Core.Mvc.ActionInvoker.pas', 20 | Quick.Core.Mvc.ActionResult in '..\..\..\..\Quick.Core.Mvc.ActionResult.pas', 21 | Quick.Core.Mvc.Context in '..\..\..\..\Quick.Core.Mvc.Context.pas', 22 | Quick.Core.Mvc.Controller in '..\..\..\..\Quick.Core.Mvc.Controller.pas', 23 | Quick.Core.Mvc.Factory.Controller in '..\..\..\..\Quick.Core.Mvc.Factory.Controller.pas', 24 | Quick.Core.Mvc.Middleware.Cache in '..\..\..\..\Quick.Core.Mvc.Middleware.Cache.pas', 25 | Quick.Core.Mvc.Middleware.Hsts in '..\..\..\..\Quick.Core.Mvc.Middleware.Hsts.pas', 26 | Quick.Core.Mvc.Middleware.MVC in '..\..\..\..\Quick.Core.Mvc.Middleware.MVC.pas', 27 | Quick.Core.Mvc.Middleware in '..\..\..\..\Quick.Core.Mvc.Middleware.pas', 28 | Quick.Core.Mvc.Middleware.Routing in '..\..\..\..\Quick.Core.Mvc.Middleware.Routing.pas', 29 | Quick.Core.Mvc.Middleware.StaticFiles in '..\..\..\..\Quick.Core.Mvc.Middleware.StaticFiles.pas', 30 | Quick.Core.Mvc.ViewFeatures in '..\..\..\..\Quick.Core.Mvc.ViewFeatures.pas', 31 | Quick.Core.Logging in '..\..\..\..\Quick.Core.Logging.pas', 32 | Quick.Core.Extensions.Entity in '..\..\..\..\Quick.Core.Extensions.Entity.pas', 33 | Quick.Core.Extensions.AutoMapper in '..\..\..\..\Quick.Core.Extensions.AutoMapper.pas', 34 | Startup in '..\..\ApiServer\source\Startup.pas', 35 | Infra.Config.App in '..\..\ApiServer\source\Infrastructure\Config\Infra.Config.App.pas', 36 | Infra.Data.DBContext.Shop in '..\..\ApiServer\source\Infrastructure\DataModel\Infra.Data.DBContext.Shop.pas', 37 | Infra.Data.Models.Costumer in '..\..\ApiServer\source\Infrastructure\DataModel\Infra.Data.Models.Costumer.pas', 38 | Infra.Data.Models.Product in '..\..\ApiServer\source\Infrastructure\DataModel\Infra.Data.Models.Product.pas', 39 | UI.Controller.Home in '..\..\ApiServer\source\UI\Controllers\UI.Controller.Home.pas', 40 | UI.Controller.Products in '..\..\ApiServer\source\UI\Controllers\UI.Controller.Products.pas', 41 | UI.Controller.Test in '..\..\ApiServer\source\UI\Controllers\UI.Controller.Test.pas', 42 | Quick.Core.Mvc.ViewEngine.Mustache in '..\..\..\..\Quick.Core.Mvc.ViewEngine.Mustache.pas', 43 | Quick.Core.Mvc.Session in '..\..\..\..\Quick.Core.Mvc.Session.pas', 44 | Quick.Core.Mvc.Middleware.HttpsRedirection in '..\..\..\..\Quick.Core.Mvc.Middleware.HttpsRedirection.pas', 45 | Quick.Core.Caching.Abstractions in '..\..\..\..\Quick.Core.Caching.Abstractions.pas', 46 | Quick.Core.Logging.Abstractions in '..\..\..\..\Quick.Core.Logging.Abstractions.pas', 47 | Quick.Core.Extensions.Caching.Redis in '..\..\..\..\Quick.Core.Extensions.Caching.Redis.pas', 48 | Infra.Data.Mappings in '..\..\ApiServer\source\Infrastructure\Mappings\Infra.Data.Mappings.pas', 49 | Domain.Models.Product in '..\..\ApiServer\source\Domain\Domain.Models.Product.pas', 50 | Quick.Core.Identity in '..\..\..\..\Quick.Core.Identity.pas', 51 | Quick.Core.Security.Claims in '..\..\..\..\Quick.Core.Security.Claims.pas', 52 | Quick.Core.Extensions.Authorization in '..\..\..\..\Quick.Core.Extensions.Authorization.pas', 53 | Quick.Core.Mvc.Middleware.Authorization in '..\..\..\..\Quick.Core.Mvc.Middleware.Authorization.pas', 54 | Quick.Core.Security.Authorization in '..\..\..\..\Quick.Core.Security.Authorization.pas', 55 | Quick.Core.Security.Authentication in '..\..\..\..\Quick.Core.Security.Authentication.pas', 56 | Quick.Core.Mvc.Middleware.Authentication in '..\..\..\..\Quick.Core.Mvc.Middleware.Authentication.pas', 57 | Quick.Core.Extensions.Authentication in '..\..\..\..\Quick.Core.Extensions.Authentication.pas', 58 | Quick.Core.Security.UserManager in '..\..\..\..\Quick.Core.Security.UserManager.pas', 59 | Quick.Core.Identity.Store.Abstractions in '..\..\..\..\Quick.Core.Identity.Store.Abstractions.pas', 60 | Quick.Core.Identity.Store.Entity in '..\..\..\..\Quick.Core.Identity.Store.Entity.pas', 61 | Quick.Core.Linq.Abstractions in '..\..\..\..\Quick.Core.Linq.Abstractions.pas', 62 | Infra.Data.Identities in '..\..\ApiServer\source\Infrastructure\DataModel\Identities\Infra.Data.Identities.pas', 63 | UI.Controller.Login in '..\..\ApiServer\source\UI\Controllers\UI.Controller.Login.pas', 64 | Quick.Core.Extensions.Authentication.ApiKey in '..\..\..\..\Quick.Core.Extensions.Authentication.ApiKey.pas', 65 | Quick.Core.Entity.Config in '..\..\..\..\Quick.Core.Entity.Config.pas', 66 | Quick.Core.Entity.DAO in '..\..\..\..\Quick.Core.Entity.DAO.pas', 67 | Quick.Core.Entity.Database in '..\..\..\..\Quick.Core.Entity.Database.pas', 68 | Quick.Core.Entity.Engine.ADO in '..\..\..\..\Quick.Core.Entity.Engine.ADO.pas', 69 | Quick.Core.Entity.Engine.FireDAC in '..\..\..\..\Quick.Core.Entity.Engine.FireDAC.pas', 70 | Quick.Core.Entity.Engine.RestServer in '..\..\..\..\Quick.Core.Entity.Engine.RestServer.pas', 71 | Quick.Core.Entity.Factory.Database in '..\..\..\..\Quick.Core.Entity.Factory.Database.pas', 72 | Quick.Core.Entity.Factory.QueryGenerator in '..\..\..\..\Quick.Core.Entity.Factory.QueryGenerator.pas', 73 | Quick.Core.Mvc.Extensions.ResponseCaching in '..\..\..\..\Quick.Core.Mvc.Extensions.ResponseCaching.pas'; 74 | 75 | var 76 | ApiServer : TWebApiServer; 77 | 78 | begin 79 | try 80 | ReportMemoryLeaksOnShutdown := True; 81 | //run as console 82 | if not AppService.IsRunningAsService then 83 | begin 84 | //create server 85 | cout('Init server...',etInfo); 86 | ApiServer := TWebApiServer.Create('127.0.0.1',8080,False); 87 | //add dependency services 88 | //ApiServer.Services.ConfigureServices(RegisterServices); 89 | //register application 90 | //ApiServer.ConfigureApp(RegisterServer); 91 | try 92 | ApiServer.UseStartup; 93 | ApiServer.Start; 94 | //Wait for Exit 95 | cout(' ',ccWhite); 96 | cout('Press [Enter] to quit',ccYellow); 97 | ConsoleWaitForEnterKey; 98 | finally 99 | ApiServer.Free; 100 | end; 101 | end 102 | else //run as a service 103 | begin 104 | AppService.DisplayName := 'Remote Server'; 105 | AppService.ServiceName := 'RemoteServerSvc'; 106 | AppService.CanInstallWithOtherName := True; 107 | AppService.OnStart := procedure 108 | begin 109 | ApiServer := TWebApiServer.Create('127.0.0.1',8080,False); 110 | //register service dependencies 111 | //ApiServer.Services.ConfigureServices(RegisterServices); 112 | //register application 113 | //ApiServer.ConfigureApp(RegisterServer); 114 | ApiServer.UseStartup; 115 | end; 116 | //AppService.OnStop := ApiServer.Free; 117 | AppService.OnExecute := ApiServer.Start; 118 | AppService.CheckParams; 119 | end; 120 | except 121 | on E: Exception do 122 | Writeln(E.ClassName, ': ', E.Message); 123 | end; 124 | end. 125 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /expert/CoreMvc.Wizard.MainForm.dfm: -------------------------------------------------------------------------------- 1 | object frmProjectWizard: TfrmProjectWizard 2 | Left = 0 3 | Top = 0 4 | BorderStyle = bsDialog 5 | Caption = 'New Quick Core Mvc Project' 6 | ClientHeight = 448 7 | ClientWidth = 691 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | OldCreateOrder = False 15 | Position = poScreenCenter 16 | OnCreate = FormCreate 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object paLogo: TPanel 20 | Left = 0 21 | Top = 0 22 | Width = 161 23 | Height = 448 24 | Align = alLeft 25 | BevelOuter = bvNone 26 | Caption = 'paLogo' 27 | Color = 4802889 28 | ParentBackground = False 29 | ParentShowHint = False 30 | ShowCaption = False 31 | ShowHint = True 32 | TabOrder = 0 33 | object imgLogo: TImage 34 | Left = 0 35 | Top = 0 36 | Width = 161 37 | Height = 177 38 | Align = alTop 39 | Center = True 40 | Picture.Data = { 41 | 0954506E67496D61676589504E470D0A1A0A0000000D49484452000000C80000 42 | 00C2080200000083A11AAF0000002D744558744372656174696F6E2054696D65 43 | 006C752E203231206D61792E20323031382032333A30353A3333202B30313030 44 | FA8868A50000000774494D4507E20515151F1B65AD9E1D000000097048597300 45 | 0004220000042201F4F578760000000467414D410000B18F0BFC610500000D5B 46 | 4944415478DAED9C7B5055D51EC70F8862A80C8269A4D7BC9A5D091F98653695 47 | 4D4EC63093A9139AD378695474441949442111B3807248419DA604D3492F3E52 48 | 144D271C6B7A38BE1FE5B5B4C64769572B98CAC644F205F77739F79EBBD96BEF 49 | B31E672DF1D4F7F307C35967B1F7DA6B7DD67B6D421A1A1A3C00E82604620113 50 | 402C600488058C00B180112016304213B19E7EFAE9E64E0F0862DE7BEF3DDFEF 51 | 100B6803620123402C600488058C00B1801120163002C402468058C008100B18 52 | 01620123402C6004881534B49FBE513CF28592679A37B5102B688058C008100B 53 | 1801620123402C600488058C00B1B471ADDF5BCD9D043B2DFF99D65CB78658DA 54 | 80585620963620961588A50D88650562690362598158DA805856209636209615 55 | 88A50D88650562690362052F104B0E882508C49243A358C1D5B5C902B1E48058 56 | 82402C39209620104B0E882508C49203620902B1E4B815C40A0A2321961C104B 57 | 108825072BD6CDF70362050AC4D2FB873713882507C4120462C901B104815872 58 | 402C4120961C104B10882507C4120462C901B10481587268144B1988152810CB 59 | 1188152810CB1188152810CB1188152810CB11881528102B78815872402C4120 60 | 961C78FD4B10882507C4120462C9A1A52BBC397FD2BC402C39209620104B0E88 61 | 2508C49203620902B1E4805882402C39209620104B0E882508C49203620902B1 62 | E4805882402C39209620104B0E882508C49203620902B1E4805882402C392096 63 | 20104B0E882508C49203E7B104815872402C4120961C37BF2B54005D210788A5 64 | 06C4E200B1D480581C20961A108B03C45203627180586A402C0E104B0D88C501 65 | 62A901B138402C3520160788A506C4E200B1D480581C20961A108B03C4520362 66 | 7180586A402C0E104B0D88C52128C45200623533104B0D88C52128C4326D8902 67 | 108B03C45203627180586A402C0E104B0D88C50162A901B138402C3520160788 68 | A506C4E200B1D480581C20961A108B03C45203627180586A402C0E104B0D88C5 69 | 0162A901B138402C3520160788A506C4E200B1D480581C20961A108B03C45203 70 | 627180586A402C0E104B0D88C50162A901B138402C3520160788A506C4E200B1 71 | D480581C20961A108B03C45203627180586A402C0E104B0D88C50162A901B138 72 | 402C3520160788A506C4E200B1D480581C20961A108B03C45203627180586A40 73 | 2C0E104B0D8805FEB0402C600488058C00B1801120163002C402468058C00810 74 | 0B1801620123402C600488058C00B1801120163002C402468058C00810AB0911 75 | 11110B162CE8D2A58B2FA4AEAEAEB0B0F0E8D1A3D668717171B9B9B9919191BE 76 | 90EAEAEACCCCCCDF7EFBADB99FE056016235213E3EFEB5D75EB305AE59B366DD 77 | BA75D6903163C63CF7DC73B6682FBEF8E2B163C79AFB096E1520561320962E20 78 | 561320962E20561320962E20561320962E205613C2C2C24A4A4AEEBAEB2E5F08 79 | CD0A5F79E5159B31108B0BC45201627181582A402C2E9AC58A888868D3A68D60 80 | E4DADADACB972FFB8F73FBEDB7DB426EDCB8F1CB2FBF283F309BC28B172F5EB9 81 | 72C5F7313434342626C6F7F1F7DF7F67973DB588151515D5B2654B9198013E32 82 | 4BBB76ED5AB76E2D18F9E79F7FAEAFAF97BD45406275EBD6EDE1871FA6114964 83 | 64241546870E1D5AB46821757BCAB29F7EFA89927EE4C891EDDBB7FFFAEBAFD6 84 | 6F3B77EEFCD65B0E2F439F3C79323F3FDF1659841123463CFFFCF3B644565757 85 | 4F9C38D1FB3B8DB1DE79E71DEB923AB162C58ACD9B375B4364C522597BF7EE3D 86 | 60C0007AA2F6EDDBD3F53B75EA249B78CA28AA03172E5CF8E1871F3EFBEC33CA 87 | B1EBD7AF8BFC615C5CDC7DF7DD47C5442AD3DD158AE9D2A54B94DB746B4AC397 88 | 5F7EB96FDF3EEE1E83A258D1D1D153A64C193870A06CEEF84FFDEBAFBFFEF9E7 89 | 9F5B03B3B2B2060F1ECC46A6879C3D7BF6F9F3E7052F4E459B9A9AFAD4534FD9 90 | C2C9EC65CB96BDFFFEFBDE8FD4402E5FBEDC16E7C30F3F5CB2648935444AAC7B 91 | EEB9E785175EB06E136981CAF8CD37DF3C74E8909F38E471464646AF5EBDF4DE 92 | FAEAD5ABE5E5E5A48E9F964C452C12BFB8B898C4D79B5C4F63AF3469D2245BFF 93 | 3861C284E1C387B39149446AB7BEFAEA2BEE65C3C3C3A968A971B58593554545 94 | 457BF7EEF58568172B3E3EBEA0A040B6851067E1C2859F7EFAA9E357641515D3 95 | 6DB7DD66E8D63B76EC78E38D37DCBE55118BA6DF0909098692CBF63B9EC62E6C 96 | FCF8F16CE4BABA3ACABBFDFBF7FBB92055839C9C9C7BEFBD97FD5B761D41AF58 97 | 349E2B2B2BB375AC7AA1C6233D3DFDC71F7FB485530B4DA5AEBD99B4E1476B69 98 | B11C97103542FDF7ABAFBECA863FF6D863D4EAB0559F5A1DEA113EF8E003C7AB 99 | 51ADCDCDCD65F3977A52B2EAF4E9D3B670BD623946D30E9B3C62C89021945DA6 100 | 6FFDFDF7DFD388C8B1439416CBAD63A2A22227E8674D4D8D489AA81E3FF0C003 101 | 7DFAF4B1857FFDF5D7B366CD72FC93FBEFBF7FE6CC998E6DFBCA952B376EB4FF 102 | 3B211ADC9055345C65B383FA50C7F1995EB1A842F7ECD9D331AF76EFDE4D3F69 103 | D6229257F408D4EE525E75EFDE9DFD96C60F63C78EB505666767B35DBFA771FC 104 | B067CF1E1A9F091613D5649A96C5C6C6D2D55AB56AC54698366DDA993367D870 105 | 69B1E6CC99C38ED9ABAAAA68082C3849F141CD756969A96D7E649DA3B1B007A1 106 | 7C6CD9B2C5EAC4830F3E989999C95A78F6ECD9BCBC3CB719A55EB16884CB2695 107 | D249D54036AFBCB80D09468D1A655D31F1B838BD73E74E6ADDB94B3C6E3943B5 108 | F1CE3BEFB48553F7651DA4FA90166BE9D2A5B6AB532548494951CB29C78AE57F 109 | 424ABD1BF5956C3B44503340F34A6A99131313274F9ECCF69BC78F1F7FE9A597 110 | 6C6560CB3E5D628585856DDAB4C916875A296AF2D5F2CACBA2458BD8762B2D2D 111 | CDD60093BBB62CA2D118CD8B15D6687C3876AF8E7D8547562C6A63D891F5175F 112 | 7C41AD885A5AA9217DE289276C81DC2534EA17C82DC7912925E6D4A95323478E 113 | 64BF22EDA854FC58E5D12A96E3229CE378480AC7468B6A8B7599C6D1E9408AC9 114 | 4FE67CFCF1C72525256C6439B104F35D1C35B13C8D6BC7944DEC5CCF0D9A1B53 115 | 2FC05D41D62896E32CA7A2A262D5AA556E77BFD17F8EA7FE7AC8A5B3A1A7D7BA 116 | C5A149CC8C19336C8154613EFAE823FF4F41FDE082050B04B3CB91F0F0F00D1B 117 | 36D802DD7CD52016F52F546C6A694D4E4E661B1EC1DD247A4ECAE24183067163 118 | FA2F4EEE036A148B3D81E3A521A273FDDFC69155DE8F21B5E7434FFDC331858E 119 | 9715112BF0C6D2D354172F06C5D28EF8362575CDE9E9E96C9B678566155BB76E 120 | 15BC607389557FF7DF1BA2FB7842BC83C206CFB5DA16C7167BAE38EC0F422C45 121 | EAEAEA9E7DF659F1F87DFBF67DF9E597DD96B6DD0AD28D66132B3EA3A16DD7FF 122 | 7F6EB81152B337F44C251B13622972F8F061124530F2430F3D346BD62C3F1B26 123 | 3415A289B7E37CD8916615EB2F5404FFFB7C3DA4664FE8D92D6CCC3F91583485 124 | 3E77EE5C8029F634AEA1D384AEB2B252F0EDBC61C386D1FC88BB0DE77F695EE4 125 | 016FC618AB5DF7FABBC77A5A45FEC7AD86FA90CBE7434FACF45CBDC0C6FC1389 126 | A525C5B2C8EE96B82DB7A83DA076B18886A8B8FABF3EF3DF59E1BFB63B5AE569 127 | 5CF8650B32E8C58A888860F345AAF30A1C1AB08F1B37CE715BE9C081036BD7AE 128 | 9D397326BB40EC6196E61DD128568F1E3DD8059EAAAA2AC71366E22426264E9D 129 | 3AD516685BFE0E3EB13C4EDB14FE3761F4425691378EBB605466A5A5A5F5F5F5 130 | 515151F9F9F9D617227CECDCB9B3B8B8D8CF6A9646B12819EC1A47E095302D2D 131 | 2D2929C91698959575E2C409D9A750C0A058454545ECC1B1C2C242FF6757B410 132 | 1E1E3E77EE5C76DFDAC3F4741493CACF71F9948A76FEFCF96EEBEF7AF70A2B2A 133 | 2AD88DDBECEC6C9133648EDC71C71DD4E0B1C3CA949414EB5E4D508A357DFAF4 134 | C71F7FDC1648932F6A30BCDBE66A47A4B95003307BF66CD6691A9BD3BC6FD7AE 135 | 5DB670B7C37D9EC6155D72CB71D74CAF58ECBEAA2FAF3EF9E4139AF4089E648F 136 | 6A24212161F4E8D16DDBB66573C0B685159462D15CCC5CC747799D9191C11679 137 | 747474414101BB465F5757376FDE3CB70680FACD2953A63CF9E493EC57348D25 138 | 4DD91BE9158B6E21B2311020DF7CF38D6D6F3828C5A2F1FBDB6FBFCDD61B5DB0 139 | C5E3769C815AC7BCBC3CEEB177EA26929393D970C753F37AC5327D28D28B6D4A 140 | 28FE140A1814CBE3B20FAA0B5BF1B81DC0A26A4A6D95E02110B756F6E2C58B34 141 | 3AB43678DACFBCA7A7A73B3699BAA08930D53ADBD82358C522860E1D9A9A9A6A 142 | E2A0BEB578FAF7EF9F9393C3DEC5FF00DC91471E79842A033BECA5CE942EE53B 143 | 73A25D2CB7B783B4E076102888C5F2A69EE2D0E858EFEB3ABE4953D7AE5D172F 144 | 5ECCAA20780086C54D531AFCD2C0EEBBEFBEF3349EC659BD7AB52DC2B66DDBCA 145 | CACAAC218E4D204D6BD843F45EA8DDA5AA3870E0402D2F5650653878F0200DFF 146 | DDDEFD727C0AF1231E7E78F7DD776D19484D260D7FD9981ADE84A6C7E8D8B123 147 | E9151313D3A95327FAA89C6EEADACACBCBBDD2D07568B243B321DFB7144E191A 148 | C8BA064DD79392926C29ACADAD5DBF7EBD6F1F893AFA7EFDFA59BFADACACB44D 149 | DF68CA49F9131B1BEB0BF9F6DB6F45CE50D0E3505E79338A7E117C1DF9DAB56B 150 | 353535D5D5D534E3A69F227349DB5350C692586A8792AD50E57CF4D147AD0923 151 | 811C87B9F8DF0DC008100B1801620123402C600488058C00B1801120163002C4 152 | 02468058C008AE6201A00B88058C00B1801120163002C40246F837553E904F4A 153 | 1919E80000000049454E44AE426082} 154 | end 155 | end 156 | object paMain: TPanel 157 | Left = 161 158 | Top = 0 159 | Width = 530 160 | Height = 448 161 | Align = alClient 162 | BevelOuter = bvNone 163 | ShowCaption = False 164 | TabOrder = 1 165 | object pageMain: TPageControl 166 | Left = 0 167 | Top = 49 168 | Width = 530 169 | Height = 358 170 | ActivePage = tabExtensions 171 | Align = alClient 172 | TabOrder = 0 173 | object tabServer: TTabSheet 174 | Caption = 'MVC Server' 175 | object Label5: TLabel 176 | Left = 13 177 | Top = 267 178 | Width = 40 179 | Height = 13 180 | Caption = 'Location' 181 | end 182 | object Label6: TLabel 183 | Left = 13 184 | Top = 235 185 | Width = 64 186 | Height = 13 187 | Caption = 'Project Name' 188 | end 189 | object edProjectPath: TEdit 190 | Left = 96 191 | Top = 264 192 | Width = 338 193 | Height = 21 194 | TabOrder = 1 195 | OnChange = OnParametersChange 196 | end 197 | object edProjectName: TEdit 198 | Left = 96 199 | Top = 232 200 | Width = 412 201 | Height = 21 202 | TabOrder = 3 203 | Text = 'CoreMvcProject1' 204 | OnChange = OnParametersChange 205 | end 206 | object btnBrowseProjectPath: TButton 207 | Left = 440 208 | Top = 264 209 | Width = 68 210 | Height = 21 211 | Caption = 'Browse' 212 | TabOrder = 2 213 | end 214 | object cxCreateProjectDirectory: TCheckBox 215 | Left = 352 216 | Top = 299 217 | Width = 153 218 | Height = 17 219 | Caption = 'Create directory for project' 220 | Checked = True 221 | State = cbChecked 222 | TabOrder = 4 223 | end 224 | object meProjecTypetInfo: TMemo 225 | Left = 327 226 | Top = 13 227 | Width = 181 228 | Height = 193 229 | ReadOnly = True 230 | ScrollBars = ssBoth 231 | TabOrder = 5 232 | end 233 | object lvProjectType: TListView 234 | Left = 13 235 | Top = 13 236 | Width = 303 237 | Height = 193 238 | Columns = < 239 | item 240 | Caption = 'Project type' 241 | Width = 170 242 | end 243 | item 244 | Caption = 'Platform' 245 | Width = 100 246 | end> 247 | Items.ItemData = { 248 | 05A40000000200000000000000FFFFFFFFFFFFFFFF01000000FFFFFFFF000000 249 | 000A4D005600430020005300650072007600650072000D570069006E0064006F 250 | 00770073002F004C0069006E007500780080D0A83400000000FFFFFFFFFFFFFF 251 | FF01000000FFFFFFFF000000000D570065006200410070006900200053006500 252 | 72007600650072000D570069006E0064006F00770073002F004C0069006E0075 253 | 00780018B9A834FFFFFFFF} 254 | ReadOnly = True 255 | RowSelect = True 256 | TabOrder = 0 257 | ViewStyle = vsReport 258 | end 259 | end 260 | object tabExtensions: TTabSheet 261 | Caption = 'Extensions' 262 | ImageIndex = 1 263 | object lvMiddlewares: TListView 264 | Left = 12 265 | Top = 176 266 | Width = 478 267 | Height = 148 268 | Checkboxes = True 269 | Columns = < 270 | item 271 | Caption = 'Application Middlewares' 272 | MinWidth = 150 273 | Width = 150 274 | end 275 | item 276 | AutoSize = True 277 | Caption = 'Description' 278 | MinWidth = 150 279 | end 280 | item 281 | Caption = 'Id' 282 | Width = 32 283 | end> 284 | Items.ItemData = { 285 | 05C80200000600000000000000FFFFFFFFFFFFFFFF02000000FFFFFFFF000000 286 | 000448005300540053001846006F007200630065002000480054005400500053 287 | 00200063006F006D0075006E00690063006100740069006F006E00F82DF74A01 288 | 31009830F74A00000000FFFFFFFFFFFFFFFF02000000FFFFFFFF000000000B53 289 | 0074006100740069006300460069006C00650073001253006500720076006500 290 | 20007300740061007400690063002000660069006C0065007300902BF74A0132 291 | 00102FF74A00000000FFFFFFFFFFFFFFFF02000000FFFFFFFF00000000115200 292 | 6500730070006F006E007300650020004300610063006800690069006E006700 293 | 25430061006300680069006E006700200072006500730070006F006E00730065 294 | 00200074006F00200073006100760065002000700072006F0063006500730073 295 | 002000740069006D006500E82AF74A0133002830F74A00000000FFFFFFFFFFFF 296 | FFFF02000000FFFFFFFF000000000B5400610073006B0043006F006E00740072 297 | 006F006C003244006100730062006F00610072006400200074006F0020006300 298 | 6F006E00740072006F006C0020007300630068006500640075006C0065006400 299 | 200061006E00640020006200610063006B00670072006F0075006E0064002000 300 | 7400610073006B007300702CF74A013400302EF74A00000000FFFFFFFFFFFFFF 301 | FF02000000FFFFFFFF000000000752006F007500740069006E00670021440065 302 | 00660069006E006500200072006F007500740065007300200074006F00200061 303 | 006300630065007300730020007200650073006F007500720063006500730080 304 | 2FF74A013500B031F74A00000000FFFFFFFFFFFFFFFF02000000FFFFFFFF0000 305 | 0000034D00560043000F5300650072007600650020004D005600430020007000 306 | 6100670065007300382CF74A013600E831F74AFFFFFFFFFFFFFFFFFFFFFFFFFF 307 | FFFFFFFFFFFFFFFFFFFFFF} 308 | ReadOnly = True 309 | RowSelect = True 310 | TabOrder = 0 311 | ViewStyle = vsReport 312 | end 313 | object lvServices: TListView 314 | Left = 12 315 | Top = 12 316 | Width = 478 317 | Height = 154 318 | Checkboxes = True 319 | Columns = < 320 | item 321 | Caption = 'Application Services' 322 | MinWidth = 150 323 | Width = 150 324 | end 325 | item 326 | Caption = 'Description' 327 | MinWidth = 150 328 | Width = 300 329 | end 330 | item 331 | Caption = 'Id' 332 | Width = 300 333 | end> 334 | Items.ItemData = { 335 | 05860200000500000000000000FFFFFFFFFFFFFFFF02000000FFFFFFFF000000 336 | 00074C006F006700670069006E0067001A4C006F006700670069006E00670020 337 | 006100700070006C00690063006100740069006F006E0020006500760065006E 338 | 0074007300302EF74A0131002830F74A00000000FFFFFFFFFFFFFFFF02000000 339 | FFFFFFFF000000000A4100750074006F004D0061007000700065007200284D00 340 | 61007000700069006E006700200044006100740061004D006F00640075006C00 341 | 65007300200074006F002000440054004F00200061006E006400200076006900 342 | 6300650076006500720073006100A82CF74A0132009830F74A00000000FFFFFF 343 | FFFFFFFFFF02000000FFFFFFFF000000000645006E0074006900740079002541 344 | 0063006300650073007300200074006F00200064006100740061006200610073 345 | 00650073002000770069007400680020004C0069006E00510020007300750070 346 | 0070006F0072007400482FF74A013300D030F74A00000000FFFFFFFFFFFFFFFF 347 | 02000000FFFFFFFF000000000C4D0065006D006F007200790020004300610063 348 | 0068006500244300610063006800650020006800650061007600790020007000 349 | 72006F006300650073007300200069006E0066006F00200069006E0074006F00 350 | 20006D0065006D006F0072007900802FF74A0134000831F74A00000000FFFFFF 351 | FFFFFFFFFF02000000FFFFFFFF000000000C5400610073006B00200043006F00 352 | 6E00740072006F006C0020520075006E0020005300630068006500640075006C 353 | 00650064002000260020006200610063006B00670072006F0075006E00640020 354 | 007400610073006B007300F02FF74A0135004031F74AFFFFFFFFFFFFFFFFFFFF 355 | FFFFFFFFFFFFFFFFFFFF} 356 | ReadOnly = True 357 | RowSelect = True 358 | TabOrder = 1 359 | ViewStyle = vsReport 360 | end 361 | object udServices: TUpDown 362 | Left = 496 363 | Top = 12 364 | Width = 21 365 | Height = 57 366 | Max = 1000 367 | Position = 500 368 | TabOrder = 2 369 | OnClick = udServicesClick 370 | end 371 | object udMiddlewares: TUpDown 372 | Left = 496 373 | Top = 176 374 | Width = 21 375 | Height = 57 376 | Max = 1000 377 | Position = 500 378 | TabOrder = 3 379 | OnClick = udMiddlewaresClick 380 | end 381 | end 382 | end 383 | object paTitlebar: TPanel 384 | Left = 0 385 | Top = 0 386 | Width = 530 387 | Height = 49 388 | Align = alTop 389 | Color = clWhite 390 | ParentBackground = False 391 | ShowCaption = False 392 | TabOrder = 1 393 | object Label1: TLabel 394 | Left = 16 395 | Top = 16 396 | Width = 219 397 | Height = 18 398 | Caption = 'Create new Core MVC Project' 399 | Font.Charset = DEFAULT_CHARSET 400 | Font.Color = clWindowText 401 | Font.Height = -15 402 | Font.Name = 'Tahoma' 403 | Font.Style = [fsBold] 404 | ParentFont = False 405 | end 406 | object Label2: TLabel 407 | Left = 360 408 | Top = 16 409 | Width = 31 410 | Height = 13 411 | Caption = 'Label2' 412 | end 413 | end 414 | object paBottom: TPanel 415 | Left = 0 416 | Top = 407 417 | Width = 530 418 | Height = 41 419 | Align = alBottom 420 | BevelOuter = bvNone 421 | ShowCaption = False 422 | TabOrder = 2 423 | DesignSize = ( 424 | 530 425 | 41) 426 | object btnCancel: TButton 427 | Left = 448 428 | Top = 8 429 | Width = 75 430 | Height = 25 431 | Anchors = [akTop, akRight] 432 | Caption = 'Cancel' 433 | ModalResult = 2 434 | TabOrder = 0 435 | end 436 | object btnOk: TButton 437 | Left = 367 438 | Top = 8 439 | Width = 75 440 | Height = 25 441 | Anchors = [akTop, akRight] 442 | Caption = 'Next' 443 | TabOrder = 1 444 | OnClick = btnOkClick 445 | end 446 | object btnBack: TButton 447 | Left = 286 448 | Top = 8 449 | Width = 75 450 | Height = 25 451 | Anchors = [akTop, akRight] 452 | Caption = 'Back' 453 | TabOrder = 2 454 | Visible = False 455 | OnClick = btnBackClick 456 | end 457 | end 458 | end 459 | end 460 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](docs/QuickCore.png "QuickCore") 2 | 3 | Delphi Framework (Windows/Linux/Android/MACOSX/IOS) to build high-performance and scalable desktop, mobile and web applications easily. Delphi 10 to 12 Athens supported. 4 | 5 | **Areas of functionality:** 6 | ---------- 7 | 8 | * **Mapping**: Map fields from a class to other class, copy objects, etc.. 9 | * **Config**: Easy integration of sections into config settings. Supports Json and Yaml formats. 10 | * **Authorization**: Authorization validation. 11 | * **Serialization**: Object/Array serialization to/from json/Yaml. 12 | * **Scheduling**: Schedule tasks launching as independent threads with retry policies. 13 | * **Database**: Easy entity framework to work with SQLite, MSSQL, etc 14 | * **UserManagement**: 15 | * **Caching:**: Cache string or objects to retrieve fast later. 16 | * **MVC Web:** Create own Api or MVC server to serve own site. 17 | 18 | ## Give it a star 19 | Please "star" this project in GitHub! It costs nothing but helps to reference the code. 20 | ![alt text](docs/githubstartme.jpg "Give it a star") 21 | 22 | ## Star History 23 | 24 | [![Star History Chart](https://api.star-history.com/svg?repos=exilon/quickcore&type=Date)](https://star-history.com/#exilon/quickcore&Date) 25 | 26 | ## Support 27 | If you find this project useful, please consider making a donation. 28 | 29 | [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=BKLKPNEYKSBKL) 30 | 31 | 32 | **Main units description:** 33 | ---------- 34 | 35 | **Abstractions:** 36 | * **Quick.Core.Logging.Abstractions:** Logging service abstractions. 37 | * **Quick.Core.Caching.Abstractions:** Memory caching service abstractions. 38 | * **Quick.Core.Mapping.Abstractions:** Mapping objects service abstractions. 39 | * **Quick.Core.Identity.Abstractions:** User identity store abstractions. 40 | * **Quick.Core.Linq.Abstractions:** LinQ abstractions. 41 | * **Quick.Core.Serialization.Abstractions:** Serialization service abstractions. 42 | 43 | **Services:** 44 | * **Quick.Core.AutoMapper:** Mapping objects service implementation. 45 | * **Quick.Core.Container:** Dependency injection container service. 46 | * **Quick.Core.Entity:** Entity database access service implementation. 47 | * **Quick.Core.Identity:** User Identity service implementation. 48 | * **Quick.Core.Logging:** Logging service implementation. 49 | * **Quick.Core.Serialization:** Json/Yaml Serialization service implementation. 50 | * **Quick.Core.TaskControl:** Task/Job control service implementation (not ready yet). 51 | * **Quick.Core.Security.UserManager:** User manager service implementation. 52 | * **Quick.Core.Security.Authentication:** Authentication service implementation. 53 | * **Quick.Core.Security.Authorization:** Authorization service implementation. 54 | * **Quick.Core.Security.Claims:** Authorization security claims definitions. 55 | 56 | **MVC:** 57 | * **Quick.Core.Mvc:** Main Mvc core implementation. 58 | * **Quick.Core.Mvc.Controller:** Controller implementation. 59 | * **Quick.Core.Mvc.ActionResult:** Controller responses implementation. 60 | * **Quick.Core.Mvc.ActionInvoker:** Controller actions implementation. 61 | * **Quick.Core.Mvc.Context:** Http Request Context implementation. 62 | * **Quick.Core.Mvc.Routing:** Mvc routing implementation. 63 | * **Quick.Core.Mvc.Session:** User session implementation (not ready) 64 | * **Quick.Core.MvcViewFeatures:** Viewdata implementation. 65 | * **Quick.Core.Mvc.ViewEngine.Mustache:** Very basic mustache template implementation. 66 | * **Quick.Core.Mvc.Middleware.Authentication:** Authentication requests middleware. 67 | * **Quick.Core.Mvc.Middleware.Authorization:** Request Authorization validation middleware. 68 | * **Quick.Core.Mvc.Middleware.Cache:** Response caching middleware. 69 | * **Quick.Core.Mvc.Middleware.Hsts:** Http Strict Transport Security middleware. 70 | * **Quick.Core.Mvc.Mvc:** Mvc main middleware. 71 | * **Quick.Core.Mvc.Middleware:** Mvc routing middleware. 72 | * **Quick.Core.Mvc.StaticFiles:** Static files middleware. 73 | * **Quick.Core.Mvc.HttpsRedirection:** Https force redirection middleware. 74 | * **Quick.Core.Mvc.TaskControl:** Task/Job control middleware(not ready yet). 75 | 76 | **Extensions:** 77 | 78 | * **Quick.Core.Extensions.Authentication:** Authentication service. 79 | * **Quick.Core.Extensions.Authentication.ApiKey:** ApiKey based Authentication. 80 | * **Quick.Core.Extensions.Authorization:** Authorization service. 81 | * **Quick.Core.Extensions.AutoMapper:** Mapping objects service. 82 | * **Quick.Core.Extensions.Caching.Memory:** Memory Cache service. 83 | * **Quick.Core.Extensions.Caching.Redis:** Redis Cache service. 84 | * **Quick.Core.Extensions.Entity:** Entity framework service. 85 | * **Quick.Core.Extensions.Serialization:** Serialization service. 86 | 87 | **Mvc Extensions:** 88 | 89 | * **Quick.Core.Mvc.Extensions.Entity.Rest:** Api Rest service. 90 | * **Quick.Core.Mvc.Extensions.ResponseCaching:** Response caching service. 91 | * **Quick.core.Mvc.Extensions.TaskControl:** Task/Job control service. 92 | 93 | **Updates:** 94 | * 11/08/2020: Added commandline extension. 95 | * 12/07/2020: Updated documentation. 96 | * 06/07/2020: First beta implementation. 97 | 98 | **Installation:** 99 | ---------- 100 | * **From package managers:** 101 | 1. Search "QuickCore" on Delphinus package managers and click *Install* 102 | * **From Github:** 103 | 1. Clone this Github repository or download zip file and extract it. 104 | 2. Add QuickCore folder to your path libraries on Delphi IDE. 105 | 3. Clone QuickLib Github repository https://github.com/exilon/QuickLib or download zip file and extract it. 106 | 4. Add QuickLib folder to your path libraries on Delphi IDE. 107 | 3. Clone QuickLogger Github repository https://github.com/exilon/QuickLogger or download zip file and extract it. 108 | 4. Add QuickLogger folder to your path libraries on Delphi IDE. 109 | 110 | # Documentation: 111 | QuickCore is a framework to easy build desktop/mobile/web apps. 112 | 113 | ## DependencyInjection 114 | 115 | Entire Framework is based on dependency injection priciples. A container holds all services needed by the application, allowing easy infrastructure changes with a minor enfort. 116 | 117 | Services are automatically injected into server and configured from a single unit "startup". 118 | Every Core project needs a startup.pas with a class inheriting from TStartupBase (see examples on samples folder). 119 | 120 | *ServiceCollection:* 121 | -- 122 | It's a collection of services where we can register predefined or custom services and control its lifecycle (singleton, transient,..). ServiceCollection is the build-in container included in QuickCore and supports constructor injection by default. 123 | ```delphi 124 | services 125 | .AddLogging(TLoggerBuilder.GetBuilder(TLoggerOptionsFormat.ofYAML,False) 126 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 127 | begin 128 | aOptions.LogLevel := LOG_DEBUG; 129 | aOptions.ShowEventColors := True; 130 | aOptions.ShowTimeStamp := True; 131 | aOptions.ShowEventType := False; 132 | aOptions.Enabled := True; 133 | end) 134 | .AddFile(procedure(aOptions : TFileLoggerOptions) 135 | begin 136 | aOptions.FileName := '.\WebApiServer.log'; 137 | aOptions.MaxFileSizeInMB := 200; 138 | aOptions.Enabled := True; 139 | end) 140 | .Build 141 | ) 142 | .AddDebugger 143 | .AddOptions(TOptionsFileFormat.ofYAML,True) 144 | //add entity database 145 | .Extension 146 | .AddDBContext(TDBContextOptionsBuilder.GetBuilder.UseSQLite.ConnectionStringName('ShopContext').Options) 147 | //add Identity 148 | .Extension() 149 | .AddIdentity(procedure(aOptions : TIdentityOptions) 150 | begin 151 | aOptions.Password.RequiredLength := 6; 152 | aOptions.User.RequireUniqueEmail := True; 153 | end) 154 | .AddEntityStore(); 155 | //add Authentication 156 | services.Extension() 157 | .AddAuthentication(procedure(aOptions : TAuthenticationOptions) 158 | begin 159 | 160 | end); 161 | //add ApiKey Authentication 162 | services.Extension 163 | .AddApiKey() 164 | .UseIdentityStore('ApiKey'); 165 | //add Authorization 166 | services.Extension 167 | .AddAuthorization(procedure(aOptions : TAuthorizationOptions) 168 | begin 169 | aOptions.AddPolicy('ApiKeyValidation',TAuthorizationPolicyBuilder.GetBuilder 170 | .RequireAuthenticatedUser.Build 171 | //.RequireClaim(TClaimTypes.Role,'Admin').Build 172 | ); 173 | end); 174 | ``` 175 | 176 | ## Basic Services 177 | 178 | *Logging:* 179 | -- 180 | QuickCore works with ILogger interface. We can use build-in Logging extension or define own implementation and inject it. 181 | 182 | To use QuickLogger implementation (Needs QuickLogger library. See installation requirements). 183 | QuickLogger uses an ILogger builder to easy configuration. Default options can be passed as Options delegate function. When QuickLogger config file exists, no default options will be applied more: 184 | ```delphi 185 | services 186 | .AddLogging(TLoggerBuilder.GetBuilder(TLoggerOptionsFormat.ofYAML,False) 187 | .AddConsole(procedure(aOptions : TConsoleLoggerOptions) 188 | begin 189 | aOptions.LogLevel := LOG_DEBUG; 190 | aOptions.ShowEventColors := True; 191 | aOptions.ShowTimeStamp := True; 192 | aOptions.ShowEventType := False; 193 | aOptions.Enabled := True; 194 | end) 195 | .AddFile(procedure(aOptions : TFileLoggerOptions) 196 | begin 197 | aOptions.FileName := '.\WebApiServer.log'; 198 | aOptions.MaxFileSizeInMB := 200; 199 | aOptions.Enabled := True; 200 | end) 201 | .Build 202 | ); 203 | ``` 204 | ...or add own logger implementation 205 | ```delphi 206 | services.AddLogging(MyLogger); 207 | ``` 208 | QuickCore logging config file is saved as QuickLogger.yml o json file. Using CORE_ENVIRONMENT environment variable we can define what file use for each implementation. If environment variable is defined, QuickCore will try to load/save "QuickCore.[CORE_ENVIRONMENT].yaml/json" file. 209 | 210 | *Options:* 211 | -- 212 | QuickCore works with Options pattern. Every TOptions object will be saved as a section in config file and can be injected into services or controllers constructors. 213 | Options service needs to added to ServiceCollection before we can add sections. We can define config filename and Json or Yaml format. 214 | ```delphi 215 | .AddOptions(TOptionsFileFormat.ofYAML,True) 216 | ``` 217 | Every config section needs to be added, and can be configured with default values. 218 | 219 | ```delphi 220 | services.Configure(procedure(aOptions : TAppSettings) 221 | begin 222 | aOptions.Smtp := 'mail.domain.com'; 223 | aOptions.Email := 'info@domain.com'; 224 | end) 225 | 226 | ``` 227 | and we can inject it later as simple as... 228 | ```delphi 229 | constructor TMyController.Create(aLogger : ILogger; aAppSettings : IOptions); 230 | begin 231 | fOptions := aAppSettings.Value; 232 | fSMTPServer.Host := fOptions.Smtp; 233 | end; 234 | ``` 235 | Into startup config you can use read options to do some optional actions: 236 | ```delphi 237 | if services.GetConfiguration.UseCache then 238 | begin 239 | //do some stuff or define service implementation 240 | end 241 | else 242 | begin 243 | //do some stuff or define alternative service implementation 244 | end; 245 | ``` 246 | Using CORE_ENVIRONMENT environment variable we can define what file use for every implementation. If environment variable is defined, QuickCore will try to load/save "QuickCore.[CORE_ENVIRONMENT].yaml" file. 247 | 248 | If not Options.Name is defined, class name will be used as section name in config file. 249 | Every Configured Option will be save and load to config file, but if we want, we can hide some options from been saved. Use Options.HideOptions := True (for internal options not configurable externally). 250 | 251 | *Debugger:* 252 | -- 253 | Debugger is a simple tracer-debugger (See QuickLib documentation). To connect debugger with a logging service only needs to add Debugger service in ServiceCollection (by default uses a console output): 254 | ```delphi 255 | services.AddDebugger; 256 | ``` 257 | 258 | *Commandline parameters:* 259 | -- 260 | Working with commandline parameters will be easy using commandline extension. 261 | Define a class inherited from TParameters or TServiceParameters (if working with QuickAppServices) with your possible arguments: 262 | ```delphi 263 | uses 264 | Quick.Parameters; 265 | type 266 | TArguments = class(TParameters) 267 | private 268 | fPort : Integer; 269 | fSilent : Boolean; 270 | published 271 | [ParamCommand(1)] 272 | [ParamHelp('Define listen port','port')] 273 | property Port : Integer read fPort write fPort; 274 | property Silent : Boolean read fSilent write fSilent; 275 | end; 276 | ``` 277 | And pass to de commandline extension: 278 | ```delphi 279 | services.AddCommandline; 280 | ``` 281 | When you call your exe with --help you get documentation. If you need to check for a switch or value, you can do like this: 282 | ```delphi 283 | if services.Commandline.Port = 0 then ... 284 | if services.Commandline.Silent then ... 285 | ``` 286 | 287 | *Add custom services:* 288 | -- 289 | Interfaces and Implementations can be added to ServiceCollection. AddSingleton and AddTransient allow define live cycle. 290 | ```delphi 291 | services.AddSingleton; 292 | ``` 293 | or with delegated creation 294 | ```delphi 295 | services.AddTransient(function : TMyService) 296 | begin 297 | Result := TMyService.Create(myparam); 298 | Result.Host := 'localhost'; 299 | end); 300 | ``` 301 | or add an implementation 302 | ```delphi 303 | services.AddSingleton; 304 | ``` 305 | 306 | ## Extensions 307 | 308 | Extensions are injectable services we can add to our app/server. Extensions are injected into ServiceCollection startup unit. 309 | ServiceCollection method Extensions works similar to .net extension methods, extendending ServiceCollection. 310 | 311 | To add an extension, we need to add its unit to Startup unit uses clause (See QuickCore predefined extensions above). 312 | ```delphi 313 | uses 314 | Quick.Core.Extensions.AutoMapper; 315 | ... 316 | begin 317 | services.Extension 318 | .AddAutoMapper; 319 | end; 320 | ``` 321 | 322 | # MVC Server 323 | With QuickCore we can create web applications with controllers and actions. 324 | 325 | ## Create AppServer 326 | Create an application server and define binding and security. 327 | ```delphi 328 | ApiServer := TMvcServer.Create('127.0.0.1',8080,False); 329 | ApiServer.UseStartup; 330 | ApiServer.Start; 331 | ```delphi 332 | To configure services and middlewares startup must configured 333 | ```delphi 334 | class procedure TStartup.Configure(app : TMVCServer); 335 | begin 336 | app 337 | .AddControllers 338 | .AddController(THomeController) 339 | .DefaultRoute(THomeController,'Home/Index') 340 | .UseWebRoot('.\wwwroot') 341 | .UseRouting 342 | .UseMVC; 343 | end; 344 | ``` 345 | **AddController(ControllerClass):** Allow add a controller to an web app server. 346 | 347 | **AddControllers:** Add all controllers registered during its initialization unit with RegisterController(ControllerClass); 348 | 349 | **UseWebRoot(path):** Define static files/data folder. 350 | 351 | **UseCustomErrorPages:** Enable use of custom error pages. On a 403 error, server will search for a 403.html, 40x.html or 4xx.html files. If dinamic page specified, simple mustache patterns will be replaced with error info (StatusCode, StatusMsg, etc). 352 | 353 | **UseMustachePages:** Simple mustache template engine to replace simple views. 354 | 355 | ## Middlewares: 356 | Middlewares are like layers of functionality and runs into a request pipeline. Every request pass for each middlwares (in creation order) or not, depending of middelware requeriments. 357 | 358 | **UseStaticFiles:** To allow serve static content. 359 | 360 | **UseHsts:** Http Strict Transport Security middleware to allow only https connections. 361 | 362 | **UseHttpsRedirection:** Enables redirection middleware to redirect on header location found. 363 | 364 | **UseRouting:** Enables Routing middleware to get matching route from request. 365 | 366 | **UseMVC:** Enable MVC middleware to manage and redirect every request to its correspondent 367 | controller action or view. 368 | 369 | **UseMiddleware:** To add custom middleware class to request pipeline. 370 | 371 | **Use(RequestDelegate):** Execute an anonymous method as a middleware. 372 | 373 | **UseAuthentication:** Tries to get authentication info from a request. 374 | 375 | **UseAuthorization:** Allow/Disallow acces to resources based on authorization policies. 376 | 377 | ## Controllers 378 | Every controller inherites from THttpController and published methods becomes actions. With custom attributes we can define routing, authorization, etc of these methods. 379 | As all controllers are injected from dependency injection, we can define constructor with autoinjectable parameters and IOC will try to resolve on constructor creation. 380 | ```delphi 381 | constructor THomeController.Create(aLogger: ILogger); 382 | ``` 383 | 384 | ## Routing 385 | Http routing is custom attributes based. We need to define routing for each controller and method/action. 386 | ```delphi 387 | [HttpGet('home/index')] 388 | function THomeController.Index : IActionResult; 389 | 390 | [HttpPost('home/GetAll')] 391 | function THomeController.GetAll : IActionResult; 392 | ``` 393 | If routing defined on class, then it's global and doesn't need to be replicated on each method/action: 394 | ```delphi 395 | [Route('home/other')] 396 | THomeController = class(THttpController) 397 | published 398 | [HttpPost('GetAll')] // global + local = home/other/GetAll 399 | function THomeController.GetAll : IActionResult; 400 | ``` 401 | 402 | ## Attributes 403 | * [NonAction] Method not configured as an action method. 404 | * [ActionName] Defines name of action if different from method name. 405 | * [Route] Defines controller routing or action routing. 406 | * [HttpGet(route)] Defines a route with a GET method. 407 | * [HttpPost(route)] Defines a route with a POST method. 408 | * [HttpPut(route)] Defines a route with a PUT method. 409 | * [HttpDelete(route)] Defines a route with a DELETE method. 410 | * [HttpMethod(method)] Defines a custom method. 411 | * [AccepVerbs([verbs])] Defines all accepted verbs. 412 | * [Authorize] Limits acces to a controller or single method to only authenticated users. 413 | * [Authorize(role)] Limits access to a controller or single method to users with x role/s. 414 | * [AllowAnonymous] If global attribute defines a more restricted authorization, using this on a method allow access it without. 415 | * [OutputCache(TTL)] If ResponseCaching middleware defined, then response from this action will be saved and retrieved from cache while TTL interval not reached. 416 | 417 | ## Handling parameters 418 | Parameters are defined with attributes and automatically parsed and injected as method parameters. 419 | ```delphi 420 | [HttpGet('Add/{productname}/{price}')] 421 | function Add(const ProductName : string; Price : Integer): IActionResult; 422 | ``` 423 | Parameters can be typed defined. 424 | Int: numeric only 425 | alpha: only letters. 426 | Float: only floating numbers. 427 | ```delphi 428 | [HttpGet('Add/{productname:alpha}/{price:float}')] 429 | function Add(const ProductName : string; Price : Extended): IActionResult; 430 | ``` 431 | An ? define a parameter as optional 432 | ```delphi 433 | [HttpGet('Add/{productname:alpha}/{price:float?}')] 434 | function Add(const ProductName : string; Price : Extended): IActionResult; 435 | ``` 436 | To get a parameter from the request body (with automatic deserialization) 437 | ```delphi 438 | [HttpPost('Add/User')] 439 | function Add([FromBody] User : TUser): IActionResult; 440 | ``` 441 | ## Action Results 442 | Action results are results of a controller. 443 | **StatusCode(statuscode, statustext):** Returns a status code and optional status text to client. 444 | ```delphi 445 | Result := StatusCode(200,'ok'); 446 | ``` 447 | **Ok(statustext):** Returns a 200 status code and optional statustext. 448 | 449 | **Accepted(statustext):** Returns a 202 status code and optional status text. 450 | 451 | **BadRequest(statustext):** Returns a 400 status code and optional status text. 452 | 453 | **NotFound(statustext):** Returns a 404 status code and optional status text. 454 | 455 | **Forbid(statustext):** Returns a 403 status code and optional status text. 456 | 457 | **Unauthorized(statustext):** Returns a 401 status code and optional status text. 458 | 459 | **Redirect(url):** Returns a temporal redirection to url. 460 | 461 | **RedirectPermament(url):** Returns a permanent redirection to url. 462 | 463 | **Content(text):** Returns a response text. 464 | 465 | **Json(object,onlypublishedproperties):** Returns a serialized json object or list. If OnlyPublishedProperties enabled, only object published properties will be serialized. 466 | ```delphi 467 | Result := Json(User); 468 | ``` 469 | **View(viewname):** Returns a view. 470 | ```delphi 471 | Result := View('home'); 472 | ``` 473 | 474 | # Core Extensions 475 | 476 | ## AutoMapper: 477 | Automapper extension allows map a class type to another class type. 478 | To use Automapper we must add service to ServiceCollection in Statup unit: 479 | ```delphi 480 | services.Extension 481 | .AddAutoMapper; 482 | ``` 483 | Then define profile maps with mapping relationship. 484 | If property names are identical, we should not have to manually provide a mapping: 485 | ```delphi 486 | constructor TMyProfile.Create; 487 | begin 488 | //maps properties with same name in both classes 489 | CreateMap(); 490 | end; 491 | 492 | initialization 493 | TAutoMapper.RegisterProfile; 494 | ``` 495 | If some properties have diferent name or type, we must use custom mappings: 496 | ```delphi 497 | constructor TMyProfile.Create; 498 | begin 499 | //maps properties with delegate function and rest maps formember 500 | CreateMap(procedure(src : TDBProduct; tgt : TProduct) 501 | begin 502 | tgt.Id := src.uid; 503 | tgt.Age := src.Age; 504 | end) 505 | .ForMember('Money','Cash') 506 | .ForMember('Name','FullName') 507 | .IgnoreOtherMembers; 508 | end; 509 | 510 | initialization 511 | TAutoMapper.RegisterProfile; 512 | ``` 513 | **ForMember(SourceProperty,TargetProperty):** Maps a source property name to a target property name. 514 | **IgnoreAllNonExisting:** Ignore all non existing properties on target. 515 | 516 | **IgnoreOtherMembers:** Only properties defined in custom mapping will be resolved. 517 | 518 | **ResolveUnmapped:** Tries to resolve automatically any map without a profilemap defined. 519 | 520 | AutoMapper service can be injected into a object/controller defining the abstraction in uses clauses. 521 | ```delphi 522 | uses 523 | Quick.Core.Mapping.Abstractions; 524 | ... 525 | TMyController.Create(aMapper : IMapper); 526 | ``` 527 | ..and use it: 528 | ```delphi 529 | product := fMapper.Map(dbproduct).AsType; 530 | ``` 531 | 532 | 533 | ## ..more documentation soon 534 | 535 | >Do you want to learn delphi or improve your skills? [learndelphi.org](https://learndelphi.org) 536 | 537 | --------------------------------------------------------------------------------