Aktivity „Spospisil“

Hi,

I'm assuming you have created the Account folder in the Pages folder of the MyProjectName.IdentityServer project :)

CustomLoginModel.cshtml in Account folder

    [Dependency(ReplaceServices = true)] 
    [ExposeServices(typeof(LoginModel))] 
    public class CustomLoginModel : LoginModel 
    { 
        public CustomLoginModel( 
            IAuthenticationSchemeProvider schemeProvider,  
            IOptions<AbpAccountOptions> accountOptions,  
            IAbpRecaptchaValidatorFactory recaptchaValidatorFactory,  
            IAccountExternalProviderAppService accountExternalProviderAppService,  
            ICurrentPrincipalAccessor currentPrincipalAccessor,  
            IOptions<IdentityOptions> identityOptions,  
            IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions) :  
            base(schemeProvider,  
                accountOptions,  
                recaptchaValidatorFactory,  
                accountExternalProviderAppService,  
                currentPrincipalAccessor,  
                identityOptions,  
                reCaptchaOptions) 
        { 
            Console.WriteLine("Test QA Question"); 
        } 
    } 

Please let us know if it works after you try it.

I'm a little confused by your response as you mentioned that this should be done in the cshtml file not the class. Could you list exactly what I need to do in order to do this as I've seend some conflicting information in the documentation.

Thanks

Hi,

I'm assuming you have created the Account folder in the Pages folder of the MyProjectName.IdentityServer project :)

CustomLoginModel.cshtml in Account folder

    [Dependency(ReplaceServices = true)]  
    [ExposeServices(typeof(LoginModel))]  
    public class CustomLoginModel : LoginModel  
    {  
        public CustomLoginModel(  
            IAuthenticationSchemeProvider schemeProvider,   
            IOptions<AbpAccountOptions> accountOptions,   
            IAbpRecaptchaValidatorFactory recaptchaValidatorFactory,   
            IAccountExternalProviderAppService accountExternalProviderAppService,   
            ICurrentPrincipalAccessor currentPrincipalAccessor,   
            IOptions<IdentityOptions> identityOptions,   
            IOptionsSnapshot<reCAPTCHAOptions> reCaptchaOptions) :   
            base(schemeProvider,   
                accountOptions,   
                recaptchaValidatorFactory,   
                accountExternalProviderAppService,   
                currentPrincipalAccessor,   
                identityOptions,   
                reCaptchaOptions)  
        {  
            Console.WriteLine("Test QA Question");  
        }  
    }  

Please let us know if it works after you try it.

I'm a little confused by your response as you mentioned that this should be done in the cshtml file not the class. Could you list exactly what I need to do in order to do this as I've seend some conflicting information in the documentation.

Thanks

To be more specific I want to override the look of of the login page, meaning I don't want the tennant selector and I also want to add/remove items in the login box and do custom code (calling different services) behind the various button clicks.

Odpoveď

Thanks for this. I notice though that the Blazor application does not run. I followed all the steps as outlined in the 'Server Side / MVC' section prior to trying to run the Blazor application and the Blazor app just gives me the spinner in the center of the page as shown in the attachment.

There is no login.cshtml.cs file. The Login* page I am using just for this sample is from the Volo.EasyCrm.Web project.

Odpoveď

H Cotur,

Can you detail out what the bug was? I'm using this project as an example of how to implement things in my project so I want to make sure this bug won't affect my project.

Thanks.

i have yes and while it creates the schema it fails on seeding the data. i get the same error message regardless.

  1. Add-Migration "HostMigration" -Context MVCTierdSepSchemaDbContext
  2. Then I run dbmigrator and receive the error message
  3. Add-Migration "TenantMigration" -Context MVCTierdSepSchemaTenantDbContext -OutputDir TenantMigrations
  4. Then I run dbmigrator and receive the error message

Now when I run the dbmigrator project it gives the following message "The string argument 'value' cannot be empty." string

Here is the stack trace

   at Microsoft.EntityFrameworkCore.Utilities.Check.NullButNotEmpty(String value, String parameterName)
   at Microsoft.EntityFrameworkCore.RelationalEntityTypeExtensions.SetSchema(IMutableEntityType entityType, String value)
   at Microsoft.EntityFrameworkCore.RelationalEntityTypeBuilderExtensions.ToTable[TEntity](EntityTypeBuilder`1 entityTypeBuilder, String name, String schema)
   at Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementDbContextModelBuilderExtensions.&lt;&gt;c__DisplayClass0_0.&lt;ConfigurePermissionManagement&gt;b__0(EntityTypeBuilder`1 b)
   at Microsoft.EntityFrameworkCore.ModelBuilder.Entity[TEntity](Action`1 buildAction)
   at Volo.Abp.PermissionManagement.EntityFrameworkCore.AbpPermissionManagementDbContextModelBuilderExtensions.ConfigurePermissionManagement(ModelBuilder builder, Action`1 optionsAction)
   at MVCTierdSepSchema.EntityFrameworkCore.MVCTierdSepSchemaDbContextBase`1.OnModelCreating(ModelBuilder builder) in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\MVCTierdSepSchemaDbContextBase.cs:line 32
   at MVCTierdSepSchema.EntityFrameworkCore.MVCTierdSepSchemaDbContext.OnModelCreating(ModelBuilder builder) in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\MVCTierdSepSchemaDbContext.cs:line 19
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, ModelDependencies modelDependencies)
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
   at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
   at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.&lt;&gt;c.&lt;TryAddCoreServices&gt;b__7_3(IServiceProvider p)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.&lt;&gt;c__DisplayClass1_0.&lt;RealizeService&gt;b__0(ServiceProviderEngineScope scope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
   at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure&lt;System.IServiceProvider&gt;.get_Instance()
   at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure&lt;System.IServiceProvider&gt;.get_Instance()
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.GetRelationalService[TService](IInfrastructure`1 databaseFacade)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.MigrateAsync(DatabaseFacade databaseFacade, CancellationToken cancellationToken)
   at MVCTierdSepSchema.EntityFrameworkCore.EntityFrameworkCoreMVCTierdSepSchemaDbSchemaMigrator.<MigrateAsync>d__2.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.EntityFrameworkCore\EntityFrameworkCore\EntityFrameworkCoreMVCTierdSepSchemaDbSchemaMigrator.cs:line 33
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MVCTierdSepSchema.Data.MVCTierdSepSchemaDbMigrationService.<MigrateDatabaseSchemaAsync>d__10.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.Domain\Data\MVCTierdSepSchemaDbMigrationService.cs:line 95
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MVCTierdSepSchema.Data.MVCTierdSepSchemaDbMigrationService.<MigrateAsync>d__9.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.Domain\Data\MVCTierdSepSchemaDbMigrationService.cs:line 52
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MVCTierdSepSchema.DbMigrator.DbMigratorHostedService.<StartAsync>d__3.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.DbMigrator\DbMigratorHostedService.cs:line 39
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>d__9.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MVCTierdSepSchema.DbMigrator.Program.<Main>d__0.MoveNext() in C:\Source Code\My Recent\MVCTieredTenantSchema\src\MVCTierdSepSchema.DbMigrator\Program.cs:line 30

now I get this error. I don't want any ABP framework table prefixes on any of the tables created whether it be the host or tenant tables.

SELECT EXISTS ( SELECT 1 FROM "SaasEditions" AS s WHERE (@__ef_filter__p_0 OR NOT (s."IsDeleted")) AND (s."DisplayName" = @__UtyMGa29B_0)) [10:22:17 ERR] An exception occurred while iterating over the results of a query for context type 'Volo.Saas.EntityFrameworkCore.SaasDbContext'. Npgsql.PostgresException (0x80004005): 42P01: relation "SaasEditions" does not exist at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "SaasEditions" does not exist Position: 41 File: parse_relation.c Line: 1373 Routine: parserOpenTable Npgsql.PostgresException (0x80004005): 42P01: relation "SaasEditions" does not exist at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "SaasEditions" does not exist Position: 41 File: parse_relation.c Line: 1373 Routine: parserOpenTable

That seems to have solved this particular issue.

Zobrazených 1 až 10 z 180 záznamov
Made with ❤️ on ABP v8.2.0-preview Updated on marca 25, 2024, 15:11