On Aug 28th we hosted a webinar on “Simplifying the Code First Approach in the Entity Framework” for the Indian region and we’d like to share the presentation and recorded webinar with you now! In the webinar, we covered:
- A review of the Code First Approach
- Creating your first database
- Managing connection strings
- Data Annotations and Fluent API
- The relationship between entities using the Annotations
- Database creation strategies
- Database initialization and seed methods
- Enabling migrations
- Updating the database
You can find recording of the webinar here:
[youtube] width="560" height="315" src="http://www.youtube.com/embed/n1q9TuAkFXQ" [/youtube]
You can also find the presentation slides here.
Some of the questions from the webinar are below. For many of the questions we will write detailed blog posts later, but enjoy these for now!
Is having Id as the column name mandatory for it to be considered as PK?
EF Code First works over convention. So if you have a column with the name id or [classname]id then EF will make it as primary key. However you are free to make any column the primary key by using the data annotation attribute [Key]
How do I create a database on a remote database server?
You can create a database on remote server by setting up the connection string in the configuration file and the passing the name of the connection string in constructor of the context class.
Does Code First work only with SQL Server?
Yes as of now Entity framework works only with SQL Server.
What is the purpose of a required attribute?
A required attribute is used to create Not Null columns. Properties assigned with Not Null will be created as columns which will not accept the null value.
Once again, thank you so much for your interest in our webinars – and we look forward to seeing you at a future presentation!