Open Closed

xxx.xxx.WebAssembly Project's Purpose #6338


User avatar
0
Spospisil created
  • ABP Framework version: v7.3.0
  • UI Type: Blazor WASM
  • Database System: EF Core (PostgreSQL
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

What is the purpose of the .WebAssembly project in each ABP's module (both standard and commercial) solution structure? I see that the blazor WASM project has a reference to the associated .WebAssemly project but it's not clear what it's purpose is.


8 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Because the Blazor Server and the Blazor WebAssembly is different, The details may be different when writing UI code, so ABP has created separate projects for them

    For example, you can inject IHttpContextAccessor in the Blazor server UI, but it's not available in Blazor WebAssembly.

  • User Avatar
    0
    Spospisil created

    Hi,

    I'm not sure you understand my question. In ABP generated module project there is a project named xxxx.WebAssembly which appears the solution. For example below is a screenshot of the Chat modules solution structure. What is the purpose of this project and what sort of code would you put in there? There is no documentation on what this project is and what it should be used for.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The details may be different when writing UI code, so ABP has created separate projects for them.

    I think I have explained the difference well.

    There is no documentation on what this project is and what it should be used for.

    It should be easy to understand. Use .Blazor.WebAssembly if your project is Blazor WebAssembly UI Use .Blazor.Server if your project is Blazor Server UI

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Let me explain more.

    To get access_token, Blazor WebAssembly and Blazor Server are different.

    In Blazor WebAssembly

    [Inject]
    protected IAccessTokenProvider AccessTokenProvider { get; set; }
    
    var token = await AccessTokenProvider.RequestAccessToken();
    

    In Blazor Server

    [Inject]
    protected IHttpContextAccessor HttpContextAccessor { get; set; }
    
    var token = HttpContextAccessor.HttpContext.GetTokenAsync("access_token");
    
  • User Avatar
    0
    Spospisil created

    Hi,

    Again, you're not understanding. In my application there is no .WebAssembly project type because it was was generated as an Application template type, however in the 'Module' template type's generated code there is a .WebAssembly project. So I'll ask again, what is the purpose of this project type and more importantly why is it not mentioned anywhere in the documentation?

    You say things should be 'easily understood' but you are assuming an expert knowledge of your framework and with documentation is less than sufficient at explaining how all the dots are connected, users of your framework are forced to search support questions and blog posts for a better understanding of how things are connected. Even example source code examples provide vary in their implementation and not well explained. "just do it like this" is the general message that often gets communicated without any detailed explanation.

    Very frustrating!

  • User Avatar
    0
    Spospisil created

    Use .Blazor.WebAssembly if your project is Blazor WebAssembly UI

    For WHAT? What am I suppose to use this for? Again, my project is based on the application template type so there isn't even a Blazor.WebAssembly project in my solution!!!

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Sorry, I really didn't get it.

    When you create a project using the ABP suite, you can see them in the UI type selection box and you should know what type you chose.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    however in the 'Module' template type's generated code there is a .WebAssembly project. So I'll ask again, what is the purpose of this project type and more importantly why is it not mentioned anywhere in the documentation

    I will update the document.

    When you create a module project, you may want it to support both Blazor WebAssembly and Blazor Server. because the details may be different when writing UI code. , so ABP has created separate projects for them.

    Anyway, you can remove it if you don't need it.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19