Activities of "cala"

context independent version of SetDefaultRepositoryClasses ( to replace EfCoreRepository for the whole project )

so we need to make the base repository generic and create a version for each module. It would be great to be able to override the generic EfCoreRepository independently from the dbcontext

Well we would like to know, how to use one repository for multiple dbcontext - none of your modules share the repository.

Hi, we created a "default" repository class that should be used by all our modules. But we have no idea how to configure it to be useable by other module dbcontext. our idea was to have a base dbcontext (IBaseDbContext) that can be used instead of the IEfCoreDbContext.

so we tried:

  • IDbContext interface inherit from IBaseDbContext instead of IEfCoreDbContext
  • DbContext implement IBaseDbContext additionally
  • replace IBaseDbContext with new DbContext ( tried attribute, module option and both together )
  • manual SetDefaultRepositoryClasses on DbContext

without manual SetDefaultRepositoryClasses ( on each DbContext ) you get the default EfCoreRepository ( instead of the new "default" repository ) without ReplaceDbContext you InvalidOperationException because the Type is not included in the context

  • ABP Framework version: v5.3.0
  • DB provider: EF Core

In our prototype project we used only one dbcontext for all module, so SetDefaultRepositoryClasses has done the job. But now we are struggling to split it into seperated dbcontext for each module. What would be the best approach for this ?

Thanks

Issue: https://github.com/abpframework/abp/issues/13110

  • Your ABP Framework version: 5.3
  • Your database provider(EF Core/MongoDB): EF Core
  • Exception message and stack trace if available (check the logs): The instance of entity type 'Setting' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values. for global and No database provider has been configured for this DbContext. A provider can be configured by overriding the 'DbContext.OnConfiguring' method or by using 'AddDbContext' on the application service provider. If 'AddDbContext' is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext. for specific
  • Steps needed to reproduce the problem:
  1. Copy BookStore example
  2. Add AuthorRepository_Tests to Acme.BookStore.EntityFrameworkCore.Tests
  3. Follow documentation to disable tracking ( try global or context specific ( SettingManagementDbContext ), both doesnt work )
  4. Run Test
  5. See exception

SettingsRepository_Tests.cs:

using System;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp.SettingManagement;
using Xunit;

namespace Acme.BookStore.EntityFrameworkCore.Samples;

public sealed class AuthorRepository_Tests : BookStoreEntityFrameworkCoreTestBase
{
	private readonly ISettingRepository _settingRepository;

	public AuthorRepository_Tests()
	{
		_settingRepository = GetRequiredService<ISettingRepository>();
	}
	
	[Fact]
	public async Task Should_Not_Track()
	{
		const string name1 = "Settings1";
		const string name2 = "Settings2";
		const string value = "A";
	        
		await WithUnitOfWorkAsync( async () =>
		{
			// Arrange
			Guid settingId = Guid.NewGuid();
			Setting setting1 = new( settingId, name1, value );
			Setting setting2 = new( settingId, name2, value );
		        
			// Act
			await _settingRepository.InsertAsync( setting1, true );
			Setting resultSetting1 = await _settingRepository.GetAsync( settingId );
			await _settingRepository.UpdateAsync( setting2, true );
			Setting resultSetting2 = await _settingRepository.GetAsync( settingId );
		        
			// Assert
			resultSetting1.ShouldNotBeNull();
			resultSetting2.ShouldNotBeNull();
			resultSetting1.Name.ShouldBe( name1 );
			resultSetting2.Name.ShouldBe( name2 );
		} );
	}
}

For more details, please check the github issue

Question
  • ABP Framework version: v5.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Hi, we would like to remove email requirement for creating new user or make it optional.

if this is "by Design" - please provide informations about where to find the related code

Thanks

Answer

Hey @EngincanV, thanks for fast response.

got a slightly different error message showing that my password was escaped incorrectly by my cmd... adding quotes fixed it^^

Question
  • ABP Framework version: v4.4.4 (CLI)
  • Exception message and stack trace:
[14:42:22 ERR] Could not get token from the OpenId Connect server! ErrorType: Protocol. Error: invalid_grant. ErrorDescription: Invalid username or password!. HttpStatusCode: BadRequest
Volo.Abp.AbpException: Could not get token from the OpenId Connect server! ErrorType: Protocol. Error: invalid_grant. ErrorDescription: Invalid username or password!. HttpStatusCode: BadRequest
   at Volo.Abp.IdentityModel.IdentityModelAuthenticationService.GetAccessTokenAsync(IdentityClientConfiguration configuration) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.IdentityModel\Volo\Abp\IdentityModel\IdentityModelAuthenticationService.cs:line 91
   at Volo.Abp.Cli.Auth.AuthService.LoginAsync(String userName, String password, String organizationName) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Auth\AuthService.cs:line 90
   at Volo.Abp.Cli.Commands.LoginCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\LoginCommand.cs:line 73
   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 158
   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 66
  • Steps to reproduce the issue:"
  1. type: abp login (username) -p (password)
  2. press enter

tried to change password but result is the same. tried passwords with 15-20 chars. two factor authentication is disabled

Showing 51 to 58 of 58 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11