when the await uow.CompleteAsync();
runs I observe that there is a change in the database
public virtual async Task UpdateNameAsync(Guid id)
{
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var book = await _bookRepository.GetAsync(id);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception")
}
but when the await uow.CompleteAsync();
runs in the code below, there is no change in the database. Surrounding unit of work manages book entity (instead of new uow)
public virtual async Task UpdateNameAsync(Guid id)
{
var book = await _bookRepository.GetAsync(id);
using var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception")
}
My original code similar like below. I want database changes to commit even though Exception is thrown.
public virtual async Task UpdateNameAsync(Guid id)
{
var book = await _bookRepository.GetAsync(id);
await UpdateNameFunctionAsync(book);
}
private async Task UpdateNameFunctionAsync(Book book)
{
var uow = unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
book.Name = DateTime.Now.ToString();
await uow.SaveChangesAsync();
await uow.CompleteAsync();
throw new Exception("an occured exception");
}
Would you consider this a bug?
Hi, I need to call a remote service in a bg-job,How can I do that?
could you give more detail. thanks.
but we don't recommend you to do this
It worked successfully when RemoteService(IsEnabled = true)
. Thanks.
Well,can't proxy classes be used in domain layer? For example I would like to use it in a manager class. I know that I need to move these classes(contracts and interfaces) to the domain in order to use them in the domain layer.
My fault. builder.ConfigureSaas()
method was being wrongly called at FirstEfCoreEntityExtensionMappings.cs
. I noticed while trying to reproduce the steps. Many thank.
I sent mail (liangshiwei@abp.io)
SQLite Error 1: 'table "SaasEditions" already exists'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.<PrepareAndEnumerateStatements>d__64.MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.<GetStatements>d__54.MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables()
at MyCompany.ABC.EntityFrameworkCore.ABCEntityFrameworkCoreTestModule.CreateDatabaseAndGetConnection() in
I have two Dbcontext and run without error. But I cannot run test. and I got error : Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: 'table "SaasEditions" already exists
public class MyFirsDbContext : AbpDbContext<MyFirsDbContext>,IHasEventInbox, IHasEventOutbox, IServicePriceDbContext
//IIdentityProDbContext,
//ISaasDbContext
{
}
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
[ConnectionStringName("Second")]
public class MySecondDbContext :AbpDbContext<MySecondDbContext>, IIdentityProDbContext, ISaasDbContext
{
...
// SaaS
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
...
}
Open a command-line terminal in the root folder of your client project (.csproj) and type the following command: With Contracts abp generate-proxy -t csharp -u http://localhost:53929/(SampleA project API url)
Note: I haven't run the SampleB project yet because I'm in the proxy generate phase. so no error logs is generated.
I got this error (command line error):
[14:47:48 ERR] Response status code does not indicate success: 500 (Internal Server Error).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at Volo.Abp.Cli.ServiceProxying.ServiceProxyGeneratorBase`1.GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args, ApplicationApiDescriptionModelRequestDto requestDto) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\ServiceProxyGeneratorBase.cs:line 37
at Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateProxyAsync(GenerateProxyArgs args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\CSharp\CSharpServiceProxyGenerator.cs:line 135
at Volo.Abp.Cli.Commands.ProxyCommandBase`1.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\ProxyCommandBase.cs:line 57
at Volo.Abp.Cli.CliService.RunInternalAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 168
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 76
I reproduced in v7.0.1 ((server and client)) but I got this output
[14:47:11 INF] ABP CLI 7.0.1
[14:47:48 ERR] Response status code does not indicate success: 500 (Internal Server Error).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at Volo.Abp.Cli.ServiceProxying.ServiceProxyGeneratorBase`1.GetApplicationApiDescriptionModelAsync(GenerateProxyArgs args, ApplicationApiDescriptionModelRequestDto requestDto) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\ServiceProxyGeneratorBase.cs:line 37
at Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateProxyAsync(GenerateProxyArgs args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\CSharp\CSharpServiceProxyGenerator.cs:line 135
at Volo.Abp.Cli.Commands.ProxyCommandBase`1.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\ProxyCommandBase.cs:line 57
at Volo.Abp.Cli.CliService.RunInternalAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 168
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 76
I got error:
[11:17:24 INF] ABP CLI 7.0.1
[11:17:26 INF] Create ClientProxies\Ekol\FFE\MP\Application\ServicePurchases\ServicePurchaseClientProxy.Generated.cs
[11:17:26 ERR] Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateClassFileAsync(GenerateProxyArgs args, ControllerApiDescriptionModel controllerApiDescription) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\CSharp\CSharpServiceProxyGenerator.cs:line 243
at Volo.Abp.Cli.ServiceProxying.CSharp.CSharpServiceProxyGenerator.GenerateProxyAsync(GenerateProxyArgs args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ServiceProxying\CSharp\CSharpServiceProxyGenerator.cs:line 143
at Volo.Abp.Cli.Commands.ProxyCommandBase`1.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\ProxyCommandBase.cs:line 57
at Volo.Abp.Cli.CliService.RunInternalAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 168
at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 76