Using EntityFramework in SharePoint

When adding the EntityFramework package from NuGet into a SharePoint project with the command:

PM> Install-Package EntityFramework

We got to make sure some things are configured into SharePoint. You’ll notice that adding the package creates a new App.config file. The XML in this file should be added to the web.config file from SharePoint. But to make sure we safely edit the config, we create an eventreceiver and add the necessary nodes there.

(more…)

Signing packages

When adding a new NuGet package to the Package folder in a SharePoint project, we often get this error, since not all packages are strongly named:

Error occurred in deployment step ‘Add Solution’: This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache.

(more…)

IoC Container in SharePoint 2013 Service

Since quite some time I started learning about Dependency Injection and IoC Containers. When I couldn’t find any solutions for SharePoint, I first thought it was impossible to do, especially constructor injection. But when I had a closer look, I started to imagine a solution for this particular problem and after a while I managed to get it working. So with no further ado, I present you my fix:

(more…)

Unable to load assembly for eventreceiver

Today I got the strangest error. Suddenly I couldn’t deploy my feature anymore, while this still worked the day before. The problem was that each time I tried to activate a feature, I got the following error:

Error occurred in deployment step ‘Activate Features’: Failed to load receiver assembly “RHTester.Intranet.Apps.RH.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7220513665f5cf5a” for feature “RHTester.Intranet.Apps.RH.Presentation_AbsenceManager – Webparts” (ID: 5c30bd9e-eb32-42df-9553-6e836a592df6).:

(more…)