Posts

Showing posts with the label Postgresql

Randomly Return Rows in EFCore with Postgresql

Currently working on a random list motorcycles to display on my front. At the moment don't have any priority listening on my site for clients other than the list of bikes I'm trying to sell personally as a source of income. For now this is what I did and its just these two parts to get things going. something . OrderBy ( r => Guid . NewGuid ()). Take ( 3 ) If you don't already have the extension this command will check and install for you. CREATE EXTENSION IF NOT EXISTS "uuid-ossp" ;

Aspetcore: NLog with Postgresql

This Article is base ASP.Net Core 2 and the latest version of Nlog. 1. Install NLog and the Postgresql Package Using NuGet to install the package into your ASP.NET Core project: PM > Install-Package NLog.Web.AspNetCore PM > Install-Package Npgsql 3. Register NLog Add in your Startup.cs  public void Configure ( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory ) { ... env.ConfigureNLog( "nlog.config" ); ... // make sure Chinese chars don't fk up Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //add NLog to ASP.NET Core loggerFactory.AddNLog(); //add NLog.Web app.AddNLogWeb(); } 4. Add to Your Controller Add a logger object to your Controller. private readonly ILogger<YourController> _logger; Modify the constructor to use it public YourController ( ILogger<YourController> logger = null ) { if ( null != logger) { _logger = logger;

Popular posts from this blog

UI-Bootstrap Collapsible Sticky Footer

Installing Windows on Acer chromebook 15 cb3-532

Aspetcore: NLog with Postgresql