Portable Area disadvantages
Asked Answered
M

2

9

For people who have experience with Portable Areas,

I would like to know if there are disadvantages to using them and why you wouldn't use them to break a large MVC application down into component parts.

Magdeburg answered 17/6, 2013 at 4:8 Comment(2)
As a side comment to my posted answer, I wanted to clarify that there is a difference between Portable Areas and the more Typical Areas. If Portable Areas don't fit your needs, conventional Areas probably do.Lunetta
Hi @DaveA, I agree with you and it's what I'm using at the moment.Magdeburg
L
12

Let's start with the

Definition:

A Portable Area is a dll that contains items that would normally be part of your solution. Portable Areas contain Views, Controllers, Models, even JS Scripts, CSS files and images.

Ideally, the items in your Portable Area work together to create cohesive functionality. If not, you are probably not benefiting from having a Portable Area.

Benefit

I compare Portable Areas to Web-Forms Web Parts because they are both an attempt to answer the question:

How do I create re-usable functionality?

You will benefit from Portable Areas if you want to create functionality to be used in multiple projects, or distributed as functionality to be consumed by 3rd parties.

Disadvantage

Every time you make a change to any View, JS File, CSS File, or image within your Portable Area, you will need to rebuild it. I emphasize these components because they do not normally need to be rebuilt when being tested or developed.

This can become a problem. If you find yourself re-building every time you tweak CSS, 30 second changes become 2 minute changes. Make 30 of those and you've stretched 15 minutes worth of work into 2 hours.

Portable Areas are meant for mature functionality to be re-used in multiple projects or solutions as-is.

  • Portable Areas are not ideal for functionality that is in early development stage.

  • Portable Areas are not ideal for functionality that exists in only 1 solution or project.

Lunetta answered 21/6, 2013 at 17:22 Comment(0)
L
9

Many things have already said. I have some experience in working with Portable Areas, and here is my personnal point of view.

  • MvcContrib has not been updated since one year (see nuget). If you take a look at codeplex, you will see that there were not so many updates in source code since the last release. It may be mature, but no support can be problematic.

  • A portable Area is self contained in a single assembly. It's easier to reuse and to upgrade for sure, but the challenge is how do you allow enough control over the User Interface by the client application. Even if it's a reusable feature, you sometimes still want to use master layout or partials.

  • All web ressources (CSS, Js, Views) have to be Embedded Resources (included in dll) . This means that it's really really a pain to dev/debug because each code modification requires a rebuild. In addition, you need to client web site to host the portable area.

  • Portable Areas use a Custom Virtual Path Provider. The Custom Virtual Path Provider code is untested and completely untestable. The use of Virtual Path Providers are discouraged by the ASP.Net team as they can cause performance problems.

  • Portable Areas Vs Nuget Packages. Portable Areas were designed four years ago (before Nuget).Portable Areas solved the ability to easy transport, view and assets(Css, javacript) files into a separate application. Nuget has also solved this problem.

However even with all of these disadvantages, my team is still using it. Why ? because it was the right solution at the right time for us.

Links answered 25/6, 2013 at 13:30 Comment(2)
Thanks hit the nail on the head, you managed to convince me against it and to stick with using Areas instead. The stickler was the issue with the virtual path provider.Magdeburg
Nuget doesn't solve the problem of keeping functionality separate anyway, it just facilitates the merging of source and assemblies into an existing project. Making that merge work properly, handling upgrades, and dealing with the horrific aftermath if you do it wrong are still all on you, especially when it comes to JS/CSS assets and configuration changes (i.e., web.config insertions). Portable Areas don't inject any source code into the importing project, which I think is good for stability.Ecclesiasticism

© 2022 - 2024 — McMap. All rights reserved.