Posts

Showing posts from June, 2015

Creating a generic Clone() method for dictionaries

I wanted to create a Clone method for dictionaries which returns the same type as the Dictionary on which the method was called: This would be quite easy if we would do an extension method for every type of dictionary, but I wanted to do this for all IDictionary implementations. Here is my solution: Since cloning works by creating a new instance with the source dictionary as constructor parameter, we have to use Activator.CreateInstance to create a new instance.

Creating a basic MVC 6 web application with Entity Framework 7 and xUnit - Part 1

Image
In my first post I'm showing you how to set up a basic MVC 6 web application with Entity Framework 7. Before we do any controllers, or creating any databases, we use xUnit and moq for creating a mock database context and testing our service. You can clone the repository with this sample from  Github . 1. Creating the projects Open Visual Studio 2015 RC and select New project . Make sure you choose .NET Framework 4.6. Now create an empty ASP.NET 5 project. Now create two projects of type Class Library, Sample1Data and Sample1DataTests : You should now have 3 projects in your solution: Next we need to install MVC 6, Entity Framework 7 and xUnit. To do this, we don't use the NuGet UI. It's easier to edit the project.json file of each project and adding the references there. Enjoy the Intellisense ;). Begin with the Sample1 project. Make sure you dependencies section looks like this: As you can see, we already added a dependency to our Sample1Data pro

Impressum

Datenschutzerklärung Diese Datenschutzerklärung klärt Sie über die Art, den Umfang und Zweck der Verarbeitung von personenbezogenen Daten (nachfolgend kurz „Daten“) innerhalb unseres Onlineangebotes und der mit ihm verbundenen Webseiten, Funktionen und Inhalte sowie externen Onlinepräsenzen, wie z.B. unser Social Media Profile auf (nachfolgend gemeinsam bezeichnet als „Onlineangebot“). Im Hinblick auf die verwendeten Begrifflichkeiten, wie z.B. „Verarbeitung“ oder „Verantwortlicher“ verweisen wir auf die Definitionen im Art. 4 der Datenschutzgrundverordnung (DSGVO). Verantwortlicher Jan-Patrick Ahnen Lisztstraße 28 67574 Osthofen https://blog.jpahnen.com/2018/05/impressum.html Arten der verarbeiteten Daten: - Bestandsdaten (z.B., Namen, Adressen). - Kontaktdaten (z.B., E-Mail, Telefonnummern). - Inhaltsdaten (z.B., Texteingaben, Fotografien, Videos). - Nutzungsdaten (z.B., besuchte Webseiten, Interesse an Inhalten, Zugriffszeiten). - Meta-/Kommunikationsdaten (z.B., Geräte-Inf