You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry, but I'm lost in the documentation. I can find examples of defining custom entities and querying custom entities and it works for me - I can create bookings in the admin interface and list them in a separate page.
I can also finde examples of commands that create custom data (not custom entities) like CatLike in the SPA example - but how do I add an instance of a custom entity to the database programmatically? Could you please clarify that in the docs?
I have a booking data model:
public class BookingDataModel : ICustomEntityDataModel
{
public DateTime? ArrivalDate { get; set; }
... more properties ...
}
I also have a web-form for submitting a booking request. I can also make a command as well as a command handler. But what should I do in the command handler?
public class AddBookingCommandHandler : ICommandHandler<AddBookingCommand>
{
private readonly CofoundryDbContext _dbContext;
public AddBookingCommandHandler(CofoundryDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task ExecuteAsync(AddBookingCommand command, IExecutionContext executionContext)
{
var booking = new BookingDataModel();
// populate booking data model with input from command
// *** THIS IS WRONG ***
// Booking data model implements ICustomEntityDataModel - but it is not a CustomEntity in itself.
await _dbContext.CustomEntities.AddAsync(booking);
// SO ... how to add the booking data model?
await _dbContext.SaveChangesAsync();
}
}
The text was updated successfully, but these errors were encountered:
Sorry, but I'm lost in the documentation. I can find examples of defining custom entities and querying custom entities and it works for me - I can create bookings in the admin interface and list them in a separate page.
I can also finde examples of commands that create custom data (not custom entities) like
CatLike
in the SPA example - but how do I add an instance of a custom entity to the database programmatically? Could you please clarify that in the docs?I have a booking data model:
I also have a web-form for submitting a booking request. I can also make a command as well as a command handler. But what should I do in the command handler?
The text was updated successfully, but these errors were encountered: