Activities of "Leonardo.Willrich"

  • ABP Framework version: v4.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I have two DBContext in my application and I want to know how to use DBMigrator to apply migration for both DBContext? To create (add-migration) and to update the database (update-database) I am using the argument -context <dbcontext>. But, how it will be possible using DBMigrator? I want to seed my database using DBMigrator.

Just as additional information, I've created a new MigrationService and implemented that. But, I still don't know how to distinguish the SeedContributor in each method. It is still calling the same class in both services.

He is my new Service being instanced and calling MigrateAsync.

public async Task StartAsync(CancellationToken cancellationToken)
        {
            using (var application = AbpApplicationFactory.Create<AvalancheOCPDbMigratorModule>(options =>
                {
                    options.UseAutofac();
                    options.Services.AddLogging(c => c.AddSerilog());
                }))
                {
                    application.Initialize();

                    await application
                        .ServiceProvider
                        .GetRequiredService<AvalancheOCPDbMigrationService>()
                        .MigrateAsync();

                    await application
                        .ServiceProvider
                        .GetRequiredService<AORDbMigrationService>()
                        .MigrateAsync();

                application.Shutdown();

                    _hostApplicationLifetime.StopApplication();
                }

        }

The problem is in the highlighted line. It is bringing all SeedContributor classes created.

public AORDbMigrationService(
            IDataSeeder dataSeeder,
            IEnumerable<IAORDbSchemaMigrator> dbSchemaMigrators,
            ITenantRepository tenantRepository,
            ICurrentTenant currentTenant)
        {
            _dataSeeder = dataSeeder; // -->> Return all list with all SeedContributor, and not the only one that is suppose to be for the DBContext
            _dbSchemaMigrators = dbSchemaMigrators;
            _tenantRepository = tenantRepository;
            _currentTenant = currentTenant;

            Logger = NullLogger<AORDbMigrationService>.Instance;
        }

Do you have any example of that? What do you mean by create manually? Should I change the service for the original DbContext? Is there some attribute for the class such as [DBContextAttribute.DbContext()]?

  • ABP Framework version: v4.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi, I have created a simple CRUD in the Blazor Commercial ABP.IO framework. I am trying to deploy to a IIS server and I am getting issue when clicking in Login link, it is returning Error 500. In the logs files, I could see:

2021-03-07 05:43:17.967 +00:00 [ERR] Invalid redirect_uri: https://avalancheocp.tvdinc.com/authentication/login-callback {"ClientId":"AvalancheOCP_Blazor","ClientName":"AvalancheOCP_Blazor","RedirectUri":null,"AllowedRedirectUris":["https://localhost:44307/authentication/login-callback"],"SubjectId":"anonymous","ResponseType":null,"ResponseMode":null,"GrantType":null,"RequestedScopes":"","State":null,"UiLocales":null,"Nonce":null,"AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":null,"Raw":{"client_id":"AvalancheOCP_Blazor","redirect_uri":"https://avalancheocp.tvdinc.com/authentication/login-callback","response_type":"code","scope":"openid profile AvalancheOCP role email phone","state":"cf815de5d3414edc8f74d53c799f1a30","code_challenge":"krQ1k5KNh9_QFBaWHwRW-JR4wXFJMUTuzpgUYcSApHA","code_challenge_method":"S256","response_mode":"query"},"$type":"AuthorizeRequestValidationLog"}

I have already changed the appsettings.json as below, but, even restarting all IIS, it keeps showing https://localhost:44307. It seems to be hardcoded in some point.

appsettings.json:

"App": {
    "SelfUrl": "https://avalancheocp.host.tvdinc.com",
    "CorsOrigins": "https://*.tvdinc.com",
		"RedirectAllowedUrls": "https://avalancheocp.tvdinc.com"
  },

What would be wrong?

  • ABP Framework version: v4.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

When I try to run DbMigrator.exe on deployed environment it says that the solution folder was not found. In the "...DbMigrationService.cs" I've found a method that gets the solution path. If not found, it raises an exception. See below:

private string GetDbMigrationsProjectFolderPath()
        {
            var slnDirectoryPath = GetSolutionDirectoryPath();

            if (slnDirectoryPath == null)
            {
                throw new Exception("Solution folder not found!");
            }

            var srcDirectoryPath = Path.Combine(slnDirectoryPath, "src");

            return Directory.GetDirectories(srcDirectoryPath)
                .FirstOrDefault(d => d.EndsWith(".DbMigrations"));
        }

        private string GetSolutionDirectoryPath()
        {
            var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory());

            while (Directory.GetParent(currentDirectory.FullName) != null)
            {
                currentDirectory = Directory.GetParent(currentDirectory.FullName);

                if (Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null)
                {
                    return currentDirectory.FullName;
                }
            }

            return null;
        }

Is that correct? Is DbMigrator suppose to be executed in deployment environement? I don't have my source code there, only the binary files generated by "Publish to Folder" option.

Hi.

I've sorted out the issue. The problem is that the both MigrationService were calling the method to seed the database. I have removed from the first service that was being called and left only in the latest one. Thus, after all tables created, it will run the seeds and if the table is empty then it will populate that as per the method implementation.

Hi @maliming. Yes, I have seed the database in my local environment (develpment) with localhost:44307. And then I have just copied the same database to the test environement with a different url.

@liangshiwei, is there a way to just run an update in the database? Do I have access to the table/field to be updated?

Perfect, it is working fine.

Question
  • ABP Framework version: v4.2.2
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I wonder if there is an option for confirmation popups for Blazor template such as in ABP Framework?

For example: https://docs.abp.io/en/abp/latest/UI/Angular/Confirmation-Service https://aspnetboilerplate.com/Pages/Documents/Javascript-API/Message

To create a confirmation poup I create a Modal in my razor page. But, I don't want to do that always, it would be awesome if there was some to do that easily.

My code:

<Modal @ref="ActiveConfirmationModal">
    <ModalContent Centered="true">
        <ModalHeader>
            <ModalTitle>@L["SupplyNetwork:DesactiveTitle"]</ModalTitle>
            <CloseButton />
        </ModalHeader>
        <ModalBody>
            @L["SupplyNetwork:DesactiveMessage"]
        </ModalBody>
        <ModalFooter>
            <Button Color="Color.Primary" Clicked="@(() => ActiveConfirmationModal.Hide())">@L["Button:Yes"]</Button>
            <Button Color="Color.Secondary" Clicked="CancelActiveCheck">@L["Button:No"]</Button>
        </ModalFooter>
    </ModalContent>
</Modal>
  • ABP Framework version: v4.2.2
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I have a modal with some fields SELECT. The first item is just a generic item to message the user to select an option. Those fields are required, I don't want leave the user save the modal with some not selected field. How can I do that? I've tried play with Validation component, but it doesn't work.

Here one of my SELECT code:

<Select TValue="int" @bind-SelectedValue="@NewEntity.NetworkTypeId">
    <SelectItem TValue="int" Value="0">@L["SupplyNetwork:SelectNetworkType"]</SelectItem>
    @foreach (var network in networkTypeList)
    {
        <SelectItem TValue="int" Value="@network.Id">
            @network.Name
        </SelectItem>
    }
</Select>
Showing 1 to 10 of 192 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11