Category SQL

Web API OData V4 Using a Singleton Part 7

This post is part 7 of the Web API and OData V4 series. This article demonstrates how to use an OData singleton with Web API. The singleton class has a list of child entities which is used to select contained entities from the SQLite database. Part 1 Getting started with Web API and OData V4 […]

Getting started with Web API and OData V4 Part 1

This article demonstrates how to create an OData V4 Web API service which uses Entity Framework 6 and SQL 2014 for persistence. OData V4 was released with Web API 2.2. The OData V4 standard is documented here: http://www.odata.org/documentation/. The Web API implementation does supports a lot of features from the standard, but not all. Part […]

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 […]

Getting started, using SQLite with .NET

This post is a collection from docs, links, code examples which I found on various blogs, websites etc. I have included the references to all my sources. Thanks for all the cool blogs, websites and of course SQLite which made it so easy to get started with this database. UPDATE 02.03.2014: With the release of […]

Enterprise Library 6, Semantic Logging, Part 1, database listener

This is a simple MVC sample which shows how to set up a basic Enterprise Library Semantic Logging (SLAB) application which logs to the database. Create a simple MVC project Get the Semantic Logging from nuget: These nuget packages adds just 4 new assemblies as shown (No Unity): Install the scripts to your database: Scripts […]

Entity Framework support for multiple domains

Discovered a cool feature in EF5. You can create multiple Edmx models in one .NET project. You can now create multiple domains with separate domain models within the same assembly. Up to now, I had one large Edmx file with all the required db objects for all my repositories and also only in one color. […]

MS SQL 2012 FileTable with new DB instance

Here’s a simple example which helps setup the new FileTable feature in a new database. EXEC sp_configure filestream_access_level, 2 RECONFIGURE GO — Create Database CREATE DATABASE FileTableDB ON PRIMARY (Name = FileTableDB, FILENAME = ‘D:\FileTable\FTDB.mdf’), FILEGROUP FTFG CONTAINS FILESTREAM (NAME = FileTableFS, FILENAME=’D:\FileTable\FS’) LOG ON (Name = FileTableDBLog, FILENAME = ‘D:\FileTable\FTDBLog.ldf’) WITH FILESTREAM (NON_TRANSACTED_ACCESS = […]

MS SQL 2012 FileTable for Existing Instance

In order to use FileTables, the following four steps must be completed, in order: 1. Enable FileStream at the instance Level 2. Provide a FileStream Filegroup 3. Enable Non-Transactional access and specify FileTable directory at the Database Level 4. Create a FileTable ALTER DATABASE ADD FILEGROUP CONTAINS FILESTREAM GO — D:FileTableContainedTestDb must exist ALTER DATABASE […]

MS SQL 2012 contained database

A cool feature in MS SQL 2012 http://blogs.msdn.com/b/mvpawardprogram/archive/2012/07/16/contained-databases-in-sql-server-2012.aspx http://msdn.microsoft.com/en-us/library/ff929055.aspx http://msdn.microsoft.com/en-us/library/ff929071.aspx Configure your SQL in Mgmt studio: The primary purpose of contained databases is to make it easier to port your database to a new server without a lot of scaffolding around it. With that in mind, I’ll treat a few potential issues that will make […]