Class InvoiceNoSqlBroker
- 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
CosmosClientoptions
DbContextOptions<InvoiceNoSqlBroker>
Properties
CosmosClient
private CosmosClient CosmosClient { get; }
Property Value
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
CreateMerchantAsync(Merchant)
Creates a new merchant.
public ValueTask<Merchant> CreateMerchantAsync(Merchant merchant)
Parameters
merchant
Merchant
Returns
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
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
Returns
DeleteMerchantAsync(Guid)
Deletes a merchant.
public ValueTask DeleteMerchantAsync(Guid merchantIdentifier)
Parameters
merchantIdentifier
Guid
Returns
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
ModelBuilderThe 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
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
Returns
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
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
ReadMerchantAsync(Guid)
Reads a merchant.
public ValueTask<Merchant?> ReadMerchantAsync(Guid merchantIdentifier)
Parameters
merchantIdentifier
Guid
Returns
ReadMerchantsAsync()
Reads all the merchants.
public ValueTask<IEnumerable<Merchant>> ReadMerchantsAsync()
Returns
ReadMerchantsAsync(Guid)
Reads all the merchants.
public ValueTask<IEnumerable<Merchant>> ReadMerchantsAsync(Guid parentCompanyId)
Parameters
parentCompanyId
Guid
Returns
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
Returns
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
Returns
UpdateMerchantAsync(Guid, Merchant)
Updates a merchant.
public ValueTask<Merchant> UpdateMerchantAsync(Guid merchantIdentifier, Merchant updatedMerchant)
Parameters
Returns
UpdateMerchantAsync(Merchant, Merchant)
Updates a merchant.
public ValueTask<Merchant> UpdateMerchantAsync(Merchant currentMerchant, Merchant updatedMerchant)