practical-aspnetcore icon indicating copy to clipboard operation
practical-aspnetcore copied to clipboard

Sample for splitting the area into different projects

Open AdrienTorris opened this issue 6 years ago • 10 comments

It could be great to have a sample to show how we can split the areas of a web app into different projects, something like this: Cms.Web (ASP.NET Core web app, contains no views and no controllers) Cms.Security (.NET Standard project, considered like the "Security" area of the Cms.Web web app) Cms.Admin (.NET Standard project, considered like the "Administration" area of the Cms.Web web app) and so on...

I still search an (elegant) solution to do this, see this issue: https://github.com/aspnet/Docs/issues/9646

I keep digging...

AdrienTorris avatar Nov 20 '18 10:11 AdrienTorris

I remember OrchardCore CMS might be doing something like this. Let me check on this this weekend.

dodyg avatar Nov 20 '18 12:11 dodyg

Ok. I'll check this and try to create a standalone version of a "distributed areas" sample.

AdrienTorris avatar Nov 20 '18 13:11 AdrienTorris

Interesting stuff about this:

  • https://stackoverflow.com/questions/41191364/is-areas-for-asp-net-core-the-same-as-portable-areas
  • https://docs.microsoft.com/en-us/aspnet/core/mvc/advanced/app-parts?view=aspnetcore-2.1

AdrienTorris avatar Nov 20 '18 14:11 AdrienTorris

The answer is maybe here: https://docs.microsoft.com/en-us/aspnet/core/mvc/advanced/app-parts?view=aspnetcore-2.1

AdrienTorris avatar Nov 20 '18 14:11 AdrienTorris

A framework allows to do this: https://github.com/ExtCore

AdrienTorris avatar Nov 20 '18 15:11 AdrienTorris

Nice find on Application Parts. I am gonna play with that one tomorrow.

dodyg avatar Nov 21 '18 17:11 dodyg

Have fun :) For me it's play with the Razor Class Libraries.

AdrienTorris avatar Nov 22 '18 09:11 AdrienTorris

The Razor Class Libraries are very interesting and for now it matches my needs, here a very first test: https://github.com/AdrienTorris/Entropy/tree/master/src/RazorClassLibrarySample

I could redo my RazorClassLibrarySample respecting your guidelines and submit it on this repository if you want.

AdrienTorris avatar Nov 22 '18 19:11 AdrienTorris

This is awesome. That would be great.

There are only two important guidelines:

  • Merge Startup.cs to Program.cs. This way people can see most of the code in a single page.
  • Remove any extraneous files that are not relevant to the sample. This will reduce the amount of confusion people can have. Pretty much strip everything to the barest possible working example.

dodyg avatar Nov 24 '18 10:11 dodyg

Ok, I just created a Pull Request, let me know if you want that I change something in the samples I push, I'll do it with pleasure.

AdrienTorris avatar Nov 26 '18 18:11 AdrienTorris