I’m planning to write a series of articles that covers the concept of micro-services using asp.net core web api, Blazor server side code,EF Core, Azure search, Azure Service Bus, Docker, Cosmos DB, Container Registry, Azure container Instance and XUNIT test using MOQ
Before going a head with the concept of micro-services, firstly, let understand the concept of entity framework core(EF core). I prefer to choose EF core rather than other concepts because the same EF core concepts can be used for SQL and No SQL database.
There might be questions coming in your head like whether EF core will support all No SQL databases? Answer is No, it only supports Cosmos DB(SQL API). We will discuss about these topic in the later articles.
Overview of EF Core
EF Core is the new version of Entity Framework after v6.x. It’s an open source, Cross Platform(runs on windows, Linux etc) and lightweight version of entity framework.
EF Core is an Object/Relation Mapping(O/RM) framework; moreover, it enhances the capability of developers to automate the storing and accessing of data in the database. Microsoft has come up with EF core and is intended to work with .net core application.
EF Development approach
EF Core supports two development approaches
- Code First Approach
- Database First Approach
ah, you might have guessed it rightly by their names.
Code First Approach is useful in Domain driven development(DDD); however, database and tables can be created by using migrations based on the convention and configuration provided in the domain classes.
Database First Approach can be used when you have existing database and it creates the domain & context classes using the existing database.
Throughout this series, I’ll be using Code First Approach.
Before we going through the examples of EF Core, let’s see how we can create SQL Server instance in Azure. However, you can do the same using local instance of SQL Server. I’ll go ahead with Azure SQL as it’s helpful for the future articles.
I would recommend you to create a free Azure account.
Step 1: Open https://portal.azure.com
Step 2: Click on “Create a new resource” and search for Azure Sql
Step 3: Enter all the Database related information. I have choose Basic as a storage group.
Step 4: Database has been created in Azure portal
Step 5: Now verify the Database connecting to Query Editor
In the next article, we’ll discuss about EF core basics.
Have a nice day!