Skip to main content
Namespace: Numa.Services
Related Models: Message.cs
Related Interfaces: IMessageService.cs

Fields

Field NameTypeDescription
_dbContextFactoryIDbContextFactory<NumaContext>DbContextFactory for instantiating instances of NumaContext on-demand

Constructor

public MessageService( IDbContextFactory<NumaContext> dbContextFactory )
{
    _dbContextFactory = dbContextFactory ?? throw new ArgumentNullException( nameof( dbContextFactory ) );
}

Properties

MessageService does not have any properties.

Methods

Method NameDescriptionParametersReturn Type
GetMessagesByConversationIdAsyncGets a list of messages for a conversation in ascending order by their CreatedDatetimestringTask<List<Message>>
AddMessageAsyncAdds a message to the Cosmos DBMessageTask

IMessageService.cs

using Numa.Models;

namespace Numa.Interfaces
{
    public interface IMessageService
    {
        Task<List<Message>> GetMessagesByConversationIdAsync( string conversationId );
        Task AddMessageAsync(Message newMessage);
    }
}