Table of Contents

Class InvoiceNoSqlBroker

Namespace
arolariu.Backend.Domain.Invoices.Brokers.DataBrokers.DatabaseBroker
Assembly
arolariu.Backend.Domain.Invoices.dll

The Entity Framework Invoice SQL broker.

public sealed class InvoiceNoSqlBroker : DbContext, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IResettableService, IDisposable, IAsyncDisposable, IInvoiceNoSqlBroker
Inheritance
InvoiceNoSqlBroker
Implements
Inherited Members

Constructors

InvoiceNoSqlBroker(CosmosClient, DbContextOptions<InvoiceNoSqlBroker>)

Entity Framework Invoice NoSQL broker constructor.

public InvoiceNoSqlBroker(CosmosClient client, DbContextOptions<InvoiceNoSqlBroker> options)

Parameters

client CosmosClient
options DbContextOptions<InvoiceNoSqlBroker>

Properties

CosmosClient

private CosmosClient CosmosClient { get; }

Property Value

CosmosClient

Methods

CreateInvoiceAsync(Invoice)

Creates a new invoice. This method is used to create a new invoice in the database.

public ValueTask<Invoice> CreateInvoiceAsync(Invoice invoice)

Parameters

invoice Invoice

Returns

ValueTask<Invoice>

CreateMerchantAsync(Merchant)

Creates a new merchant.

public ValueTask<Merchant> CreateMerchantAsync(Merchant merchant)

Parameters

merchant Merchant

Returns

ValueTask<Merchant>

DeleteInvoiceAsync(Guid)

Deletes an invoice. This method is used to delete an invoice from the database. The invoice is identified by the invoice identifier.

public ValueTask DeleteInvoiceAsync(Guid invoiceIdentifier)

Parameters

invoiceIdentifier Guid

Returns

ValueTask

DeleteInvoiceAsync(Guid, Guid)

Deletes an invoice. This method is used to delete an invoice from the database. The invoice is identified by the invoice identifier.

public ValueTask DeleteInvoiceAsync(Guid invoiceIdentifier, Guid userIdentifier)

Parameters

invoiceIdentifier Guid
userIdentifier Guid

Returns

ValueTask

DeleteMerchantAsync(Guid)

Deletes a merchant.

public ValueTask DeleteMerchantAsync(Guid merchantIdentifier)

Parameters

merchantIdentifier Guid

Returns

ValueTask

OnModelCreating(ModelBuilder)

Override this method to further configure the model that was discovered by convention from the entity types exposed in DbSet<TEntity> properties on your derived context. The resulting model may be cached and re-used for subsequent instances of your derived context.

protected override void OnModelCreating(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

The builder being used to construct the model for this context. Databases (and other extensions) typically define extension methods on this object that allow you to configure aspects of the model that are specific to a given database.

Remarks

If a model is explicitly set on the options for this context (via UseModel(IModel)) then this method will not be run. However, it will still run when creating a compiled model.

See Modeling entity types and relationships for more information and examples.

ReadInvoiceAsync(Guid)

Reads an invoice. This method is used to read an invoice from the database. The invoice is identified by the invoice identifier.

public ValueTask<Invoice> ReadInvoiceAsync(Guid invoiceIdentifier)

Parameters

invoiceIdentifier Guid

Returns

ValueTask<Invoice>

ReadInvoiceAsync(Guid, Guid)

Reads an invoice. This method is used to read an invoice from the database. The invoice is identified by the invoice identifier.

public ValueTask<Invoice> ReadInvoiceAsync(Guid invoiceIdentifier, Guid userIdentifier)

Parameters

invoiceIdentifier Guid
userIdentifier Guid

Returns

ValueTask<Invoice>

ReadInvoicesAsync()

Reads all the invoices. This method is used to read all the invoices from the database. The invoices are returned as an enumerable.

public ValueTask<IEnumerable<Invoice>> ReadInvoicesAsync()

Returns

ValueTask<IEnumerable<Invoice>>

ReadInvoicesAsync(Guid)

Reads all the invoices. This method is used to read all the invoices from the database. The invoices are returned as an enumerable.

public ValueTask<IEnumerable<Invoice>> ReadInvoicesAsync(Guid userIdentifier)

Parameters

userIdentifier Guid

Returns

ValueTask<IEnumerable<Invoice>>

ReadMerchantAsync(Guid)

Reads a merchant.

public ValueTask<Merchant?> ReadMerchantAsync(Guid merchantIdentifier)

Parameters

merchantIdentifier Guid

Returns

ValueTask<Merchant>

ReadMerchantsAsync()

Reads all the merchants.

public ValueTask<IEnumerable<Merchant>> ReadMerchantsAsync()

Returns

ValueTask<IEnumerable<Merchant>>

ReadMerchantsAsync(Guid)

Reads all the merchants.

public ValueTask<IEnumerable<Merchant>> ReadMerchantsAsync(Guid parentCompanyId)

Parameters

parentCompanyId Guid

Returns

ValueTask<IEnumerable<Merchant>>

SetModelReferences(ModelBuilder)

private static void SetModelReferences(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

SetModelReferencesForInvoiceModel(ModelBuilder)

private static void SetModelReferencesForInvoiceModel(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

SetModelReferencesForMerchantModel(ModelBuilder)

private static void SetModelReferencesForMerchantModel(ModelBuilder modelBuilder)

Parameters

modelBuilder ModelBuilder

UpdateInvoiceAsync(Guid, Invoice)

Updates an invoice. This method is used to update an invoice in the database. The invoice is identified by the invoice identifier.

public ValueTask<Invoice> UpdateInvoiceAsync(Guid invoiceIdentifier, Invoice updatedInvoice)

Parameters

invoiceIdentifier Guid
updatedInvoice Invoice

Returns

ValueTask<Invoice>

UpdateInvoiceAsync(Invoice, Invoice)

Updates an invoice. This method is used to update an invoice in the database. The invoice is identified by the invoice identifier.

public ValueTask<Invoice> UpdateInvoiceAsync(Invoice currentInvoice, Invoice updatedInvoice)

Parameters

currentInvoice Invoice
updatedInvoice Invoice

Returns

ValueTask<Invoice>

UpdateMerchantAsync(Guid, Merchant)

Updates a merchant.

public ValueTask<Merchant> UpdateMerchantAsync(Guid merchantIdentifier, Merchant updatedMerchant)

Parameters

merchantIdentifier Guid
updatedMerchant Merchant

Returns

ValueTask<Merchant>

UpdateMerchantAsync(Merchant, Merchant)

Updates a merchant.

public ValueTask<Merchant> UpdateMerchantAsync(Merchant currentMerchant, Merchant updatedMerchant)

Parameters

currentMerchant Merchant
updatedMerchant Merchant

Returns

ValueTask<Merchant>