The following comments are what i've seen in my experience.
Quote:
I made my model classes and AppContext class for Database, but my Database created only when i made Migration,
Your database gets created when you take an action against the DB. For example, simply running your application won't create the databse, but if you go and register a user to the database (or insert a user) then the schema will be updated.
Quote:
But I thought that the Database is created when i run my application and every time i run application it created with any update i make in the model classes
and any change i make to class model will reflect on the database, as example when add new property to specific class that add new column in the table in the database
Your database doesn't just know to update itself based on code, you either have to run the command Update-Database (
Entity Framework Code First Migrations[
^]) or it looks like you can setup your web.config to automatically update the database (
c# - Entity framework code first - how to run Update-Database for production database - Stack Overflow[
^]) but I would think this is a terrible idea as you'd be committing DB changes that, without being tested, could break your app.
Quote:
But what about using application in Production level by end users ?
Not sure what you are asking here, but using code first is fine for production. Just create a deployment process that screens any production related migrations (this is where i would advise against auto updating DB via web.config) that could break your environment.