salty_pepper
salty_pepper
CC#
Created by salty_pepper on 6/2/2024 in #help
What's the difference between webhook and sending an HTTP request to an endpoint exposed by client
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Thanks heaps! Cleared up my confusion!
8 replies
CC#
Created by salty_pepper on 6/2/2024 in #help
What's the difference between webhook and sending an HTTP request to an endpoint exposed by client
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Would it be correct to say webhook is basically a callback for when something happens. And that it only exist for system to system communication? Since end users don't have api endpoints. For real time updates between end users and servers, we should use WebSocket instead.
8 replies
CC#
Created by salty_pepper on 4/8/2024 in #help
✅ Never thought I would have to ask this, but Console.WriteLine() is not working
Thanks!
9 replies
CC#
Created by salty_pepper on 4/8/2024 in #help
✅ Never thought I would have to ask this, but Console.WriteLine() is not working
Ahhh too much javascript
9 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
Reference type variables themselves are stored on the stack, is that correct?
Sorry it was a typo, I meant if we create int variables directly, they are stored on the stack
10 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
Reference type variables themselves are stored on the stack, is that correct?
Also is this why we don't have boxing/unboxing with List<int>, because those ints are stored directly on the heap ( albeit inside the List array )
10 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
✅ How is aggregate in DDD related to event sourcing and CQRS?
Lol I'm trying to learn microservices, and all these jargons confuse me
20 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
✅ How is aggregate in DDD related to event sourcing and CQRS?
It sounds like aggregate is just projection
20 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
✅ How is aggregate in DDD related to event sourcing and CQRS?
Yep, I understand DDD, CQRS and Event sourcing are separate things. In an event driven architecture with microservices, we often couple event sourcing with CQRS. Where each microservice has its own event store (event sourcing), coupled with separate read model and write model (CQRS) However I'm having a difficulty wrapping my head around where DDD and in particular, aggregates come in. DDD to me is a way of designing microservices. It has 3 layers, application layer ( web api ), domain model layer ( entities, interfaces), infra layer ( repository implementation and efcore).
20 replies
CC#
Created by salty_pepper on 3/20/2024 in #help
✅ How is aggregate in DDD related to event sourcing and CQRS?
I keep seeing people talking about aggregate in event sourcing CQRS systems, so I'm really confused
20 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
tack sa mycket 🙏 🙏 🙏
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Think I got this! The code you wrote helped out a lot! Extension method
public static class ServiceCollectionExtensions {
// Call this method in the main project
public static void AddCandidateService(this IServiceCollection services) {
services
.AddOptions<DatabaseOptions>()
.BindConfiguration(DatabaseOptions.SectionName);
services.AddScoped<IPositionRepository, PositionRepository>();
services.AddScoped<ICandidateRepository, CandidateRepository>();
services.AddScoped<ICandidateFactory, CandidateFactory>();
services.AddScoped<ICandidateCreditService, CandidateCreditServiceClient>();
services.AddTransient<ITimeProvider, TimeProvider>();
}
}
public static class ServiceCollectionExtensions {
// Call this method in the main project
public static void AddCandidateService(this IServiceCollection services) {
services
.AddOptions<DatabaseOptions>()
.BindConfiguration(DatabaseOptions.SectionName);
services.AddScoped<IPositionRepository, PositionRepository>();
services.AddScoped<ICandidateRepository, CandidateRepository>();
services.AddScoped<ICandidateFactory, CandidateFactory>();
services.AddScoped<ICandidateCreditService, CandidateCreditServiceClient>();
services.AddTransient<ITimeProvider, TimeProvider>();
}
}
This is the DatabaseOptions class
namespace Refactoring.LegacyService;

public class DatabaseOptions {

public const string SectionName = "ConnectionStrings";

public string ApplicationDatabase { get; set; } = string.Empty;
}
namespace Refactoring.LegacyService;

public class DatabaseOptions {

public const string SectionName = "ConnectionStrings";

public string ApplicationDatabase { get; set; } = string.Empty;
}
It would be injected into a class like below, eg. in a repository
public CandidateRepository(IOptions<DatabaseOptions> options) {
_connectionString = options.Value.ApplicationDatabase;
}
public CandidateRepository(IOptions<DatabaseOptions> options) {
_connectionString = options.Value.ApplicationDatabase;
}
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
🙏
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Much is appreciated!
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Am I in 2024 now? 😆
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Right, the actual project using this library will be configuring the config via ConfigurationBuilder, and we will add the settings files from there. Then we do something like services.Configure<XXXSettings>(Configuration.GetSection("XXXSettings")); And in the class library we can inject IOptions<XXXSettings>
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Thanks btw!
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Right, so this appsettings.json is stored in the caller project. But class libraries should be agnostic of such settings, which is why you defined FooOptions.cs right?
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Would newer way be using IConfiguration ?
61 replies
CC#
Created by salty_pepper on 3/17/2024 in #help
Who handles dependency Injection in a class library?
Right, so it works but it's ancient
61 replies