@@rajsilwal6120 you're absolutely right, I was already working before I found this video series. My coding ability has certainly been raised. This is the best tutorial on dot net core ever.
I'm not a pro but I work in a large Software Company with experienced people. So, as far as I know, when you already have a database or a database model ready(which means you know your business very well), and you know which tables you will need and all other stuff then you can go for DB first approach. But if you are starting a new project where the whole scope is not known and you will expand it in future then going for Code first approach is better. Even though everything depends on you but still if you are trying to differentiate then this may help you :)
Nice @@LetCode96666. I do feel even for new projects, changing the database directly would be easier and simple indeed of doing and maintaining migrations. Not sure did i miss any benefits of code first approach?
@@coderggk6819 It does where you have no physical access to a database. I remember, once I had to unplug a wire from the wall - internal network - so I can get access to a database.
Hello venkat i am watching your tutorials from 6 to 7 years and i learn so much now first time i want to asking question please reply me: when i add migrations and update database command i am facing this error ? SQLite Error 1: 'table "Artikel" already exists can you tell me what the issue ? why my database not updating i just add a single column in my table ?
Excellent video! Is it possible to mix code first and data first approach? I already have a DB, but I need to add several more tables probably using code first. Can I switch between the two?
First you need to rename the property and it's references, add a new migration named RenamePhotoPathColumn and then update the database. This will rename the table column in the database without affecting the existing data.
How can we deploy these packages on PROD?Do we need to checkin migration files along with other changes? Do devops engg write thier scripts to deploy these files on PROD DB? Please reply......
I have a question, suppose that I have added a new column "PostName" in the database and updated the database using a migration. Now my website is being used by users heavily and maybe after 1 month because of some requirement I need PostName column to be deleted, if I directly run "Remove-Migration" what will happen to the data being stored in the database, will it be deleted and what will happen to all the files which is refering to my "Post" model which is now updated and it does not have "PostName" column?
If you do that you would have 2 columns with the same name-if sql allows that. Think about it, you add a column to the table, then you add a property in the class that represents that table, then you add a migration and update the database which gives you a second column with the same name. If this tutorial wasn't clear create a sample project and practice on it. Add migrations and remove them a couple of times. You'll see that it's easy. Good luck
@@ljupconewman9357 But that is not what he is saying. He is saying can he manually add the columns instead of using a migration to do it 'automatically'. I agree it is a lot of extra steps. But i guess the argument is, if you do it manually, your schema sits outside of source control. Also, you should have a separate database for testing and staging; so you have multiple places to keep in sync, but using a mechanism like this, should allow you to get all the changes right on a dev db, and then run the command to bring your production db inline, when the time is right, without worry about tracking all the different changes you have been making.
@@knssoftware6018 I know what he is saying. Doing it manually is database first approach, something he doesn't understand and doesn't want to. I told him to read more to get more familiar with the subject as everyone watching this tutorial should.
@@ljupconewman9357 Truly it's not easy and seems over complicated to make so many changes just to be in sync. But I'm not used to do it like this, I hope in the future will be something more easy and straightforward.
Sir, I got the object refernce exception error. when I exclude 'Remove-Migration' command from the 'Package Manager Console' tool in visual studio 2019 and used netcoreapp3.1 Could you please provide the solution?
What if we want to add more than one picture for the user.. should we make the photoPath property array of strings? Well what will the datatype of the field be in the database??
I've a lil doubt and am sorry if its a very stupid question but why are we adding new migrations for everytime we make a change in our database design? Can't we just have one single migration when we finalize what will be our final database design. Or is it just because you are teaching us step by step n thats why you are adding new migrations instead of removing old one n creating a new one that will have the final db design?
Hii, When you want to move to production env, at that time you can delete all previous migration and create only one migration to upload. Later on if you change something on prod env DB then again you have to add migration.
What will happen if i have added one more property Employee_DBO in Employee class, and manually change the database ,add this property in Employee table. Is it impacts any?
When a video is uploaded, youtube first presents it in lowest quality. You have t wait a few minutes then the other resolutions comes available :) maybe you watched the video to early
For everyone who is asking the same question if you add a column via sql server and then add the property and make the migration you would have 2 columns with the same name-if sql allows that. Think about it, you add a column to the table, then you add a property in the class that represents that table, then you add a migration and update the database which gives you a second column with the same name. If this tutorial wasn't clear create a sample project and practice on it. Add migrations and remove them a couple of times. You'll see that it's easy. Good luck
If we add a column and create a property manually, why would we then execute a migration? That would defeat the whole purpose wouldn't it? You seem to be under the impression that I'm talking about executing both procedures. I am asking if I could do just the manual procedure? Can I Sir? If I do, will it work or will there be a conflict throwing an exception? Remember, I only need to know if I can execute the manual process via the SQL Server Management Studio or the Server Explorer.
@@DharmendraSingh-lq2rc if you add a column and don't add a property that's okay. But if for whatever reason in the future you decide to do a new migration and update the database, entity framework will read that you don't have a property and delete the column you previously created. This is called Code First Approach- approach which allows creating the database by writing C# code in classes. Please read more about it.
@@ljupconewman9357, thx for your reply Sir. In both my threads, I am clearly communicating that I will be adding a column to the Employee table and a property to the Employee class as I am doing in this thread. Can you please explain what makes you think that I will not add a property to the Employee class? Secondly, for the third time, let me make clear that I am intending to add a column to the Employee table with a corresponding property to the class. Can I do that Sir?
@@ljupconewman9357 Thank you Sir, I have and found it that it is possible to add columns and properties manually just as we used to in the past and not use migration. One can develop the entire database objects, entities, sprocs, and relationships and create classes and never use migration. Entirely possible. Sorry to have taken up your time. Take care.
If there was an Olympic gold medal for 'Best Teacher Ever,' you’d have a trophy room so big :)
thank you very much. EF core is little bit different than previous EF version. I thought it was daunting. You remove that fear from me.
Thank you Venkat, Your tutorials have been so helpful since I started my career.
can this tutorials help me to get a job?
@@amermagdy5440 hello mate, if you follow through these tutorials and practice along. I believe you will land on something?
@@rajsilwal6120 thanks alot this gives me energy to continue god bless you
@@rajsilwal6120 you're absolutely right, I was already working before I found this video series. My coding ability has certainly been raised. This is the best tutorial on dot net core ever.
Thank you very much. Venkat. I watch a lot of tutorials regarding migrations. This one is on is very clear. 👍
Sir, Very sequential tutorial. Thanks for uploading!
Hello sir, can we(or should we) use code first to manage database for very big projects? Please make a detailed video on this topic.
I'm not a pro but I work in a large Software Company with experienced people. So, as far as I know, when you already have a database or a database model ready(which means you know your business very well), and you know which tables you will need and all other stuff then you can go for DB first approach. But if you are starting a new project where the whole scope is not known and you will expand it in future then going for Code first approach is better.
Even though everything depends on you but still if you are trying to differentiate then this may help you :)
Nice @@LetCode96666. I do feel even for new projects, changing the database directly would be easier and simple indeed of doing and maintaining migrations. Not sure did i miss any benefits of code first approach?
@@LetCode96666 I agree, ERP projects are very large projects and therefore it always uses DB first with dedicated DBA's, Architects. etc.
@@coderggk6819 It does where you have no physical access to a database. I remember, once I had to unplug a wire from the wall - internal network - so I can get access to a database.
Wow great explanation
i have just watched one, its perfect videos. about to watch the rest
Hello venkat
i am watching your tutorials from 6 to 7 years and i learn so much now first time i want to asking question please reply me:
when i add migrations and update database command i am facing this error ?
SQLite Error 1: 'table "Artikel" already exists
can you tell me what the issue ? why my database not updating i just add a single column in my table ?
Awesome Just learnt it in one video!
owesome, I am following all ur tutorials
this is awesome content. Thank you Sir! Finally i understand
we are following you brother......keep the good work.
Excellent video! Is it possible to mix code first and data first approach? I already have a DB, but I need to add several more tables probably using code first. Can I switch between the two?
Hello Sir
I have a question-
What if we have saved some data against the PhotoPat column, How can we Remove-Migration at that time?
First you need to rename the property and it's references, add a new migration named RenamePhotoPathColumn and then update the database. This will rename the table column in the database without affecting the existing data.
Thanks for detail explaination
How can we deploy these packages on PROD?Do we need to checkin migration files along with other changes?
Do devops engg write thier scripts to deploy these files on PROD DB?
Please reply......
Sir, Please reply for this
Thank you very much
I have a question, suppose that I have added a new column "PostName" in the database and updated the database using a migration. Now my website is being used by users heavily and maybe after 1 month because of some requirement I need PostName column to be deleted, if I directly run "Remove-Migration" what will happen to the data being stored in the database, will it be deleted and what will happen to all the files which is refering to my "Post" model which is now updated and it does not have "PostName" column?
You explain it so good!
Do we have to keep/maintain those migration files inside a project overtime?
thank you Excellent video
but how to receive an empty DB if I filled out Data-Base ? Just clean SQL ? I didn't find any commands in Package MAnager Console
Can we add a column to the table manually and then add a property to the Employee class? This is a lot of work...complicated also. Thx.
If you do that you would have 2 columns with the same name-if sql allows that. Think about it, you add a column to the table, then you add a property in the class that represents that table, then you add a migration and update the database which gives you a second column with the same name. If this tutorial wasn't clear create a sample project and practice on it. Add migrations and remove them a couple of times. You'll see that it's easy. Good luck
@@ljupconewman9357 But that is not what he is saying. He is saying can he manually add the columns instead of using a migration to do it 'automatically'. I agree it is a lot of extra steps. But i guess the argument is, if you do it manually, your schema sits outside of source control. Also, you should have a separate database for testing and staging; so you have multiple places to keep in sync, but using a mechanism like this, should allow you to get all the changes right on a dev db, and then run the command to bring your production db inline, when the time is right, without worry about tracking all the different changes you have been making.
@@knssoftware6018 I know what he is saying. Doing it manually is database first approach, something he doesn't understand and doesn't want to. I told him to read more to get more familiar with the subject as everyone watching this tutorial should.
@@ljupconewman9357 Truly it's not easy and seems over complicated to make so many changes just to be in sync. But I'm not used to do it like this, I hope in the future will be something more easy and straightforward.
For Dev env this migration way is good but how to move these changes to prod env ?
Thank you so much
Superb!!
perfect thank you
Thanks a lot I am waiting for the next video ♡
Great
Sir, I got the object refernce exception error. when I exclude 'Remove-Migration' command from the 'Package Manager Console' tool in visual studio 2019 and used netcoreapp3.1
Could you please provide the solution?
What if we want to add more than one picture for the user.. should we make the photoPath property array of strings? Well what will the datatype of the field be in the database??
you have to create a new child class with a relationship with the parent model.
@@imikhan83
It's hard to be understood 😅 I am sorry but thank you bro
@@bashirmanafikhi I wish I could help you more 🙂
I've a lil doubt and am sorry if its a very stupid question but why are we adding new migrations for everytime we make a change in our database design? Can't we just have one single migration when we finalize what will be our final database design. Or is it just because you are teaching us step by step n thats why you are adding new migrations instead of removing old one n creating a new one that will have the final db design?
Hii, When you want to move to production env, at that time you can delete all previous migration and create only one migration to upload.
Later on if you change something on prod env DB then again you have to add migration.
What will happen if i have added one more property Employee_DBO in Employee class, and manually change the database ,add this property in Employee table. Is it impacts any?
Here sync will not happen with model and db coumn. So u can't access new property.
Nice
Thanks alot
Can we go for binary data to upload file
enjoyable
Dear sir, How to change the column misspelled name with data? I mean that column contains some data.
Just rename the property, add a migration and update the db, the data will remain intact. Good luck
What happend if I have data and then I remove the column with a new migration without this column?
I do have same question,
Have you got answer?
Welcome back.
Perfect
thank you
Hi Venkat can you look help please for this issue ''index was outside the bounds of the array."
This is amazing!
You need to make your video more than 360p. It's hard to see.
Isn't it there brother?
I can see in 720 px. If you are on mobile click on 3 dots choose quality and you will be able to see that. Hope this helps
When a video is uploaded, youtube first presents it in lowest quality. You have t wait a few minutes then the other resolutions comes available :) maybe you watched the video to early
You can change the settings to 720p by clicking the gear icon on the video screen
First to View.
For everyone who is asking the same question if you add a column via sql server and then add the property and make the migration you would have 2 columns with the same name-if sql allows that. Think about it, you add a column to the table, then you add a property in the class that represents that table, then you add a migration and update the database which gives you a second column with the same name. If this tutorial wasn't clear create a sample project and practice on it. Add migrations and remove them a couple of times. You'll see that it's easy. Good luck
If we add a column and create a property manually, why would we then execute a migration? That would defeat the whole purpose wouldn't it? You seem to be under the impression that I'm talking about executing both procedures. I am asking if I could do just the manual procedure? Can I Sir? If I do, will it work or will there be a conflict throwing an exception? Remember, I only need to know if I can execute the manual process via the SQL Server Management Studio or the Server Explorer.
@@DharmendraSingh-lq2rc if you add a column and don't add a property that's okay. But if for whatever reason in the future you decide to do a new migration and update the database, entity framework will read that you don't have a property and delete the column you previously created.
This is called Code First Approach- approach which allows creating the database by writing C# code in classes. Please read more about it.
@@ljupconewman9357, thx for your reply Sir. In both my threads, I am clearly communicating that I will be adding a column to the Employee table and a property to the Employee class as I am doing in this thread. Can you please explain what makes you think that I will not add a property to the Employee class? Secondly, for the third time, let me make clear that I am intending to add a column to the Employee table with a corresponding property to the class. Can I do that Sir?
@@DharmendraSingh-lq2rc do some reading on enitity framework code first approach.
@@ljupconewman9357 Thank you Sir, I have and found it that it is possible to add columns and properties manually just as we used to in the past and not use migration. One can develop the entire database objects, entities, sprocs, and relationships and create classes and never use migration. Entirely possible. Sorry to have taken up your time. Take care.
Thank you