Activities of "Jurjen"

Quick question,

The last hour I've been wondering why the migrations of my module don't get picked up by de DbMigrator. Looking in an older project (v5) I found some code that was not in the EntityFrameworkCore{ApplicationName}DbSchemaMigrator in my V9.0.0 solution:

    /* 
     * Modules Migrations:
     * One call for each AbpModule DbContext.
     */

    await _serviceProvider
        .GetRequiredService<{ModuleName}.EntityFrameworkCore.{ModuleName}DbContext>()
        .Database
        .MigrateAsync();

After putting this in it worked like a charm. Is this code supposed to be generated when using 'abp add-module ....' ? or should we just add this manually because I couldn't find this in the documentation. In that case I would have to make a not of that ..

Hi,

Took some time but at this time I can make migrations in my module, not really sure why. I suppose the code I initially added wasn't complete.

However the generated migration doesn't compile

it seems the SqlServerModelBuilderExtensions don't get recognised (see picture), it needs the package Microsoft.EntityFrameworkCore.SqlServer which doesn't seem to be installed in the generated module-project {ModuleName}.EntityFrameworkCore

After installing:

install-package Microsoft.EntityFrameworkCore.SqlServer

It compiles/builds again :-)

  • ABP Framework version: v9.0.0
  • UI Type: Blazor WASM / Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I want to create a migration for the tables in my Module, I'm doing this from the PackageManager console I've selected modules{ModuleName}.EntityFrameworkCore project as 'Default project' Then I execute the following:

add-migration -name "Initial" -context {ModuleName}DbContext

which results in:

Build started... Build succeeded. File 'E:\Gits.Git.Projects\Idas\VITRUVIUS-ABP900\src{Application}.Blazor\bin\Debug\net9.0{ModuleName}.EntityFrameworkCore.dll' not found.

I found an article online indicating that perhaps the package Microsoft.EntityFrameworkCore.Tools is missing, installed that in my {ModuleName}.EntityFrameworkCore.

I set {ModuleName}.EntityFrameworkCore as startup project, and the again doing the same add-migration I now get

add-migration -name "Initial" -context {ModuleName}DbContext

which then results in: Build started... Build succeeded. Unable to create a 'DbContext' of type '{ModuleName}DbContext'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[{ModuleName}.EntityFrameworkCore.{ModuleName}DbContext]' while attempting to activate '{ModuleName}.EntityFrameworkCore.VitruviusBaseDbContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 Name

I'm not sure how to proceed. Perhaps you can point me in the right direction as to how to work with migrations for a module ?

Kind regards, Jurjen.

  • ABP Framework version: v9.0.0
  • UI Type: Blazor
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace: Invalid namespace
  • Steps to reproduce the issue: generate new module

When generating a module

abp add-module {ModuleName} --new --add-to-solution-file -t module-pro -u blazor -v 9.0.0

In the {ModuleName}.Blazor project, in the Pages folder, a folder {ModuleName} is generated containing a file index.razor (the sample page for the module)

Problem with this is that the namespace for this page is not specified and will be based on the folder-structure:

{ModuleName}.Blazor.Pages.{ModuleName}

This causes a kind of circular reference and causes all kinds of problems when referencing anything in the {ModuleName}.Blazor namespace

If I then create a folder within the Pages folder, for instance ControlLayout And I create a new Razor page there And I add

@using {ModuleName}.Blazor.Pages.ControlLayout

I get a red-squigly line under 'Blazor' part of the namespace and my project won't compile.

if I reference other projects starting their namespace with {ModuleName} I get similar problems

Setting the namespace for this Samplepage, adding the following line to the index.razor seems to solve the problem.

@namespace VitruviusBase.Blazor.Pages.SamplePage

I do have a sample project demonstrating this, so if it's helpful I can send it.

  • ABP Framework version: v5.1.3
  • UI type: Blazor
  • DB provider: EF Core

We are wondering why some projects are .NET standard and others .NET 6.

We think we need make references from Application to several .NET 6 projects, we can off course 'upgrade' the Module 'Application' project to .NET 6 but we're not sure why it is a .NET standard project and what the consequences of this upgrade would be.

Are the .NET standard projects there for compatibility reasons, so they can be referenced by other type of solutions or platforms ?

Can you explain the reason behind that?

Kind regards, Jurjen.

Module:

            Application                     .NET standard
            Application.Contracts           .NET standard
            Blazor                                          .NET 6.0
            Blazor.WebAssembly                              .NET 6.0
            Domain                          .NET standard
            Domain.Shared                   .NET standard
            EntityFramework                                 .NET 6.0
            HttpApi.Client                  .NET standard
            HttpApi                                         .NET 6.0

Application:

            Application                                     .NET 6.0
            Application.Contracts           .NET standard
            Blazor                                          .NET 6.0
            DbMigrator                                      .NET 6.0
            Domain                                          .NET 6.0
            Domain.Shared                   .NET standard
            EntityFramework                                 .NET 6.0
            HttpApi                                         .NET 6.0
            HttpApi.Client                  .NET standard
            HttpApi.Host                                    .NET 6.0

thank you. I'll look into that.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.1.3
  • UI type: Blazor
  • DB provider: EF Core
  • Exception message and stack trace: n/a
  • Steps to reproduce the issue: n/a

We'd like to be able to, on the fly, retrieve an object from DI/IOC. In our situation it's not possible to do this through injection in the class constructor.

With ASP.NET Zero we could use IocManager.Resolve<type>

Is something similar possible with ABP.IO

kind regards, Jurjen.

Yes, that works !! :-D Thank you!

Hi,

The code does not work. Looking at the gitbhub link, I see that
Response.HasStarted has not been added to the 'if' statement.

if (context.HttpContext.Response.StatusCode == (int)HttpStatusCode.OK && context.HttpContext.Response.HasStarted == false && // <-- this one context.Result == null) {

Goodmorning Maliming,

Thanks for you quick response :-) I have added the code to the solution.

The AbpNoContentActionFilter class from your response needs to be MyNoContentActionFilter?

When running the code I still get the exception.

When I remove the code from OnActionExecutionAsync(...) which sets the Response.Statuscode, then the exception does not occur.

Is that correct ?

public class MyNoContentActionFilter : IAsyncActionFilter, ITransientDependency
{
    public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
    {
        await next();
    }
}       

When you correct this in a next release will this be mentioned in the release notes? So we can remove this custom code from our solution ?

Showing 1 to 10 of 22 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07