Entity Framework


Code-First Database Design with Entity Framework and PostgreSQL

Entity Framework is an Object-Relational Mapper for .NET applications, and the code-first approach using Entity Framework allows developers to use their domain model to build and query databases directly from their data model objects. In this article, we’ll take a look at how to use the Entity Framework in C# to create a table in a PostgreSQL database. Using a domain model for Car a  as an example, we’ll take a look at different ways to configure the framework using data annotations and take a look at how different model decoration attributes affect the underlying table created by Entity Framework. You […]


Redis cache for PostgreSQL in Entity Framework 6

Database caching is a commonly used technique to improve scalability. By offloading database work to other, faster stores it can also help improve the availability of the data too. Often, though, that caching comes at the cost of hardwired code in the application to check the cache first before the database. But what if we could do it cheaply and transparently to the application? Let’s try to leverage the C# and the features of Entity Framework 6 to do all the heavy lifting. I’ll show how to use PostgreSQL database with the framework and how to add transparent caching using […]


Entity Framework 6, database-first with Oracle

I spent a lot of time trying to find out how to implement Entity Framework 6 database-first scenario with Oracle database. It’s not as straightforward as you might think. I searched various websites and found only confusing information. Finally I got it working, therefore I can confirm that EF6 database-first works with Oracle databases. First, let me clarify my environment. I have Visual Studio 2013 and .NET Framework 4.5.2 installed. Secondly, a word about my goal. I wanted to create a MVC5 website that connects to existing Oracle database. So, here is how I did it. Setup Oracle Developer Tools […]