How to easily extend your app using MediatR notifications

Probably the biggest question you face as a developer every single day is “where to put your code”? Should you use repositories or query classes? Should you have one class or two to represent your domain object? Should you write a new class or extend an existing one?
In short what constitutes a single responsibility and how separate should your concerns actually be?
MediatR Notifications can help with some of these thorny issues.

jonhilton.net/2016/08/31/how-to-easily-extend-your-app-using-mediatr-notifications/

EPiServer edit and admin not working after upgrade to EPiServer 11.8

I have upgraded a site from EPiServer 7.5 to 11.8.
When deploying the upgraded site to the test environment the edit and admin interface stopped working (the top episerver ui menu visible but lots of js errors and no “main edit window visible” and entire admin mode 404 not found).

The problem was related to some old config for “ProtectedAddons”, i just commented the below config in web.config on test server and the edit and admin mode works again.

(comment out/remove below from web.config)

<!--<virtualPathProviders>
<clear />
<add name="ProtectedAddons" virtualPath="~/epi/" physicalPath="[appDataPath]\Modules" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet" />
</virtualPathProviders>-->

Inspiration for the solution came from here: Object reference error in initialization modules

change a .net 4.6.1 project to .net 4.7 failed – Stack Overflow

when I change the targetting from .net 4.6.1 to .net 4.7 . I get this error when build , but there is no project .json , how can I pass this? project cannot compile now. Severity Code Description Project File Line Suppression State Error ` Your project is not referencing the “.NETFramework,Version=v4.7” framework. Add a reference to “.NETFramework,Version=v4.7” in the “frameworks” section of your project.json, and then re-run NuGet restore.

Delete /bin and /obj and rebuild your solution.

 

Source: change a .net 4.6.1 project to .net 4.7 failed – Stack Overflow

Extension methods for obtaining ContentReference from LinkItem and Url

(for EPiServer 8+)

…two simplified methods to cover LinkItem and Url:

public static ContentReference ToContentReference(this LinkItem linkItem)
        {
            if (linkItem == null)
                return ContentReference.EmptyReference;

            var content = UrlResolver.Current.Route(new UrlBuilder(linkItem.Href));
            return content != null ? content.ContentLink : ContentReference.EmptyReference;
        }

And

public static ContentReference ToContentReference(this Url url)
        {
            if (url == null)
                return ContentReference.EmptyReference;

            var content = UrlResolver.Current.Route(new UrlBuilder(url));
            return content != null ? content.ContentLink : ContentReference.EmptyReference;
        }

Source: Safest method of obtaining ContentReference from LinkItem

EPiServer CMS 11 reset search index url (EPiServe built in search)

(By THACH Lockevn, 1/4/2018 9:46:19 AM) To reset the search index, admin goes to IndexContent.aspx In CMS 11, IndexContent.aspx is included in the new EPiServer.Search.Cms package The URL has changed from /EPiServer/CMS/Admin/IndexContent.aspx  to /EPiServer/EPiServer.Search.Cms/IndexContent.aspx

Source: Breaking changes (CMS 11)

asp.net mvc – razor views are not giving compile time error – Stack Overflow

Razor views are dynamically compiled by the ASP.NET runtime. If you want your views to be built at compile-time you could add the following option to your .csproj file:
<PropertyGroup>
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>

You may take a look at the this article for more details.

Source: asp.net mvc – razor views are not giving compile time error – Stack Overflow

The Onion Architecture : part 1 : Jeffrey Palermo (.com)

I’ve spoken several times about a specific type of architecture I call “Onion Architecture”. I’ve found that it leads to more maintainable applications since it emphasizes separation of concerns throughout the system. I must set the context for the use of this architecture before proceeding. This architecture is not appropriate for small websites. It is appropriate for long-lived business applications as well as applications with complex behavior. It emphasizes the use of interfaces for behavior contracts, and it forces the externalization of infrastructure.
jeffreypalermo.com/blog/the-onion-architecture-part-1/