Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Razor Libraries and extending ASP.NET Zero code base #5246


User avatar
0
kyckradmin created

Hi Folks, We're attempting to extended our generated ASPNET.ZERO Web Application library with Razor View class libraries. We have a very basic page up and running using a simple controller , but we needed to modify the Startup.cs to register the external library by convention. IocManager.RegisterAssemblyByConvention(type(RazorLibrary.SomeType).GetAssembly());

I'm just wondering if there is an way to get this registration without having to modify any code. Is it possible to register these with configuration maybe?


3 Answer(s)
  • User Avatar
    0
    bbakermmc created

    How did you make your razor pages? Are you inheriting from the base ABPRazorPage? or just Page? I was looking at going down this path also, but I got the PageContext is not valid if I use the abprazorpage and if I use Page I dont get all the localization and stuff and havent had time to go back to work thru making a new class and stuff :) I did add a ticket a while ago about this since I think it would help alot with keep code separated and migrations easier.

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1189">https://github.com/aspnetzero/aspnet-ze ... ssues/1189</a>

  • User Avatar
    0
    kyckradmin created

    I'm using .NETCore 2.1. I'm inheriting the controller from AbpController, and returning a view from there. It works with a very simple page, just having some difficulty with Models being passed in at the moment, they are always null on the page. I was not aware of the ABPRazorPage, I will see if that may help with my Model issues.

  • User Avatar
    0
    kyckradmin created

    Hi Folks, Could not get this working with Razor pages in a class library, but I could get it working with standard MVC Pages in the class library. I'm not too familiar with MVC but this is an option for us anyway, to separate out the various different views that we have. If anyone has success with Razor pages please let me know and I'll progress on from there, but for now the effort is not worth it, we may be best till this is supported in the base boilerplate framework.