Skip to content

Instantly share code, notes, and snippets.

View hgmauri's full-sized avatar

Henrique Mauri hgmauri

View GitHub Profile
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Microsoft.EntityFrameworkCore.Tools
dotnet new webapi -n NomeDoProjeto
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=ORMComparisonDB;Trusted_Connection=True;"
}
}
Install-Package Dapper
@hgmauri
hgmauri / sql
Created November 1, 2024 20:49
Install-Package Microsoft.EntityFrameworkCore.SqlServer
Install-Package Microsoft.EntityFrameworkCore.Tools
dotnet --version
[HttpGet]
public Task<IActionResult> GetSampleQuestPdf()
{
var result = GeneratePdf();
return Task.FromResult<IActionResult>(File(result, "application/octet-stream", "arquivo.pdf"));
}
private byte[] GeneratePdf()
{
QuestPDF.Settings.License = LicenseType.Community;
var document = Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A4);
page.Margin(2, Unit.Centimetre);
using OllamaSharp;
using Serilog;
using Serilog.Events;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Debug)
.CreateLogger();
Log.Information("Iniciando");