I am using Umbraco 13 and following this documentation https://docs.umbraco.com/umbraco-cms/extending/database to create custom tables in Umbraco. Custom tables are created in my database but when I trying to insert data to the table using example from the documentation I still getting empty table. There are no errors in console. This is my service
public async Task AddGlossaryTranslation(GlossaryDto model)
{
using (var scope = _scopeProvider.CreateScope())
{
var db = _scopeAccessor.AmbientScope!.Database;
db.BeginTransaction();
try
{
await db.InsertAsync<GlossaryDto>(model);
db.CompleteTransaction();
}
catch (Exception)
{
db.AbortTransaction();
throw;
}
finally
{
scope.Complete();
}
}
}
Can't insert into my custom table.
I am using Umbraco 13 and following this documentation https://docs.umbraco.com/umbraco-cms/extending/database to create custom tables in Umbraco. Custom tables are created in my database but when I trying to insert data to the table using example from the documentation I still getting empty table. There are no errors in console. This is my service
I think I had the same issues, but changed code to do the following
scope.Database.Save(mymodel);
is working on a reply...