Skip to content

Instantly share code, notes, and snippets.

View ragavendra's full-sized avatar

() => { } ragavendra

View GitHub Profile
@ragavendra
ragavendra / EmailService.cs
Last active June 24, 2024 20:01
Email service DI with Ethereal free fake smtp and Dummy service for non -prod
using System.Net.Mail;
namespace TodoApi.Services
{
public interface IEmailService
{
public Task SendEmail(string email, string body);
}
// For non - prod
@ragavendra
ragavendra / CsharpCallback.cs
Created June 14, 2024 20:38
Callbacks in Csharp like CommonJS style
using System;
using System.Threading.Tasks;
public class Program
{
public static void Main()
{
ReadFile("", (err, data) => {
if(err != null) {
@ragavendra
ragavendra / Program.cs
Created June 4, 2024 22:02
Dotnet new webapi project Dependency Injection
using webapi;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// builder.Services.AddSingleton<ISampleInterface, SampleClass>();