Base solution for your next web application
Open Closed

Partial Classes #6659


User avatar
1
statuscast created

Is there any significant reason why we can't change pretty much every class in all AspNetZero projects to PARTIAL classes? This would make preserving source files integrity during AspNetZero's frequent upgrade process much easier. That was we could extend services, entities, etc without having to modify your original source files or relying on inheritence. Simple and clean.


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    This approach seems uncommon, but you can give it a try.

  • User Avatar
    1
    statuscast created

    Not sure why it seems "uncommon", Partial classes are incredibly powerful. There's ZERO effect and no downside to marking the AspNetZero classes as partial for us. It would let our code sit side-by-side much easier. As it stands right now, everytime we want to enhance or extend your code, we are boxing ourselves in from any upgrades you release unless we want to spend days and days merging source code.

    Why couldn't AspNetZero just go through and mark all their classes as partial for us? It would allow everyone to put most of their custom code that needs to be integrated directly into AspNetZero code in seperate files.

  • User Avatar
    0
    alexanderpilhar created

    I also make ASPNETZERO classes partial when I need to extend them somehow. But when merging I still have to check the ASPNETZERO classes because they are marked to be different since I added partial to them. If they would be partial from begin with, merging process would be a little easier/faster (less checks to do).

  • User Avatar
    0
    aaron created
    Support Team

    Use Git. #6285 (answer)

  • User Avatar
    0
    statuscast created

    Aaron --

    I'm not quite sure what you are implying here with such a terse response.

    Of course we already use Git and everytime there's a new AspNetZero release, we have to spend sometimes DAYS merging the code base. Primarily because we have had to integrate TONS of custom code into AspNetZero's source files. It's a grueling and incredily time consuming process.

    Our current example: we are about 4 releases behind the latest AspNetZero release. Running a code compare and merge has literally THOUSANDS of items we have to review manually because we have so much of our code integrated directly in to AspNetZero code. It's just the nature of the beast. Custom permissions, login flows, modified login screens, additional startup calls, integrated Hangfire queues, etc etc There's 10,000 different reasons why the base code is changed per customer.

    With binary based or library based frameworks this is easy. With frameworks trying to accomplish what AspNetZero does (which is a framework, not a library), we could eliminate 90% of these issues by simply adding the word PARTIAL to all the classes. It would make life so much easier for all your customers.

    Suggesting we spend days trying to run complicated code merges when the inclusion of the word partial on AspNetZero class could solve most the problem isn't really helpful.

  • User Avatar
    0
    aaron created
    Support Team

    You can make it partial.

  • User Avatar
    0
    statuscast created

    Yes, obviously.

    I'm not asking if WE can make every AspnetZero entity and service classes partial. I am asking if AspnetZero could please mark them partial. It would benefit everyone and has no downside.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @statuscast,

    I couldn't find the exact issue but it was discuessed before. Could you create an issue on GitHub (https://github.com/aspnetzero/aspnet-zero-core/issues) and discuss it over there.

  • User Avatar
    1
    aaron created
    Support Team