Category Unity

Web API OData V4 Using Unity IoC, SQLite with EF6 and OData Model Aliasing Part 5

This post is part 5 of the Web API and OData V4 series. This article shows how Web API 2.2 with OData V4 can be used together with Unity as an IoC, Entity Framework with SQLite for persistence and also creates an OData service which can do CRUD operations. OData Model Aliasing features are used […]

Web API File Upload with MS SQL SERVER FileTable

This article demonstates how the setup a file upload using Web API and save it to a MS SQL Server database using a FileTable. Because a FileTable is used, the files can be saved directly to the database, without creating an extra stream. The files can be then accessed using the database or directly in […]

Managing internal Dependencies in Libraries

When creating software components, it is often forgotten that it has to be easy to use. A lot of components are designed with an IoC and lots of unit tests. When using the component, the parent software should not need to create all the internal dependencies. This requires internal knowledge of the library which should […]

Using Web API with a Nest elasticsearch backend

This article demonstrates how to create a Web API RESTful service and use Elasticsearch as the persistence infrastructure. Nest is used to access Elasticsearch store. Simple CRUD is supported in the controller. code: https://github.com/damienbod/WebAPIRestWithNest Update 2014.09.28: updated all NuGet packages and fixed NEST, breaking changes in version 1 Structure The Application structure is based on […]

Web API 2 Using ActionFilterAttribute, OverrideActionFiltersAttribute and IoC Injection

ActionFilters are a great way to add extra functionality to your Web API service. This article shows examples of how the ActionFilters work together, how the filters can be overrided and how the filters can be used together with an IoC. The diagram underneath shows how the filters are called in the Web API lifecycle. […]

Creating an MVC5 App with Unity, SLAB and Attribute Routing

This posts explains how to set up an MVC5 application using Unity 3 and Semantic Logging (SLAB). Attribute Routing is used for the controllers. Code: https://github.com/damienbod/MVC5UnitySlab Adding Unity 3 to the MVC5 project Add the NuGet packages to the MVC5 project. Now add the start up logic in the UnityConfig file in the App_Start folder. […]

using SQLite with Entity Framework 6 and the Repository Pattern

In this post, a Data access layer is implemented using the repository pattern together with entity Framework 6 and SQLite as a database. The post continues on from Getting started, using SQLite with .NET UPDATE 02.03.2014: Using the new SQLite version 1.0.91.3 now with the SQLite provider. The xml app configuration needs to be changed […]

SignalR Messaging A more complete server with a Console Application

This post continues on from: SignalR Messaging with console server and client, web client, WPF client Now the server will be developed with some error handling, proper logging, an IoC and an Client assembly with an interface and DTOs. Code: https://github.com/damienbod/SignalRMessagingErrorHandling.git To make it easier to use in a .NET client project, we can create […]

Using SignalR with Unity

This post demonstrates how to use Unity as an IoC for SignalR. To inject into SignalR, the Microsoft.AspNet.SignalR.Hubs.IHubActivator class should be used. Code: https://github.com/damienbod/SignalRHostWithUnity Step 1: Use NuGet to add Unity and SignalR and also SignalR Self Host Step 2: Create an UnityHubActivator class. This class implements the IHubActivator interface. The Unity container is used […]

Slab Logging with an IoC Container

Slab Logging or Semantic Logging is part of the Microsoft Enterprise Library 6. In this post, a wrapper framework will be used to log and use EventSource classes. The EventSource can then be used with an IoC container without requiring static constructors. We don’t want to create a wrapper class for each EventSource. Static methods […]