Keeping domain models and database schema in sync in asp net core

  Рет қаралды 100,492

kudvenkat

kudvenkat

Күн бұрын

Пікірлер: 80
@rajsilwal6120
@rajsilwal6120 4 жыл бұрын
Thank you Venkat, Your tutorials have been so helpful since I started my career.
@amermagdy5440
@amermagdy5440 4 жыл бұрын
can this tutorials help me to get a job?
@rajsilwal6120
@rajsilwal6120 4 жыл бұрын
@@amermagdy5440 hello mate, if you follow through these tutorials and practice along. I believe you will land on something?
@amermagdy5440
@amermagdy5440 4 жыл бұрын
@@rajsilwal6120 thanks alot this gives me energy to continue god bless you
@dhirajkhapangi3249
@dhirajkhapangi3249 4 жыл бұрын
@@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.
@commentorsilensor3734
@commentorsilensor3734 4 жыл бұрын
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.
@coolwaterdvr
@coolwaterdvr 5 жыл бұрын
Thank you very much. Venkat. I watch a lot of tutorials regarding migrations. This one is on is very clear. 👍
@vaibhavtrikolikar4902
@vaibhavtrikolikar4902 4 ай бұрын
If there was an Olympic gold medal for 'Best Teacher Ever,' you’d have a trophy room so big :)
@MechanicalEI
@MechanicalEI 5 жыл бұрын
Sir, Very sequential tutorial. Thanks for uploading!
@codeRS95
@codeRS95 5 жыл бұрын
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.
@LetCode96666
@LetCode96666 5 жыл бұрын
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 :)
@coderggk6819
@coderggk6819 4 жыл бұрын
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?
@stefangabor5985
@stefangabor5985 2 жыл бұрын
@@LetCode96666 I agree, ERP projects are very large projects and therefore it always uses DB first with dedicated DBA's, Architects. etc.
@stefangabor5985
@stefangabor5985 2 жыл бұрын
@@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.
@abrahammagomo
@abrahammagomo 4 жыл бұрын
i have just watched one, its perfect videos. about to watch the rest
@it-pro6803
@it-pro6803 3 жыл бұрын
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?
@nifraz
@nifraz 2 жыл бұрын
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.
@nitin495
@nitin495 5 жыл бұрын
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......
@talkathiriify
@talkathiriify 5 жыл бұрын
Sir, Please reply for this Thank you very much
@code8180
@code8180 4 жыл бұрын
this is awesome content. Thank you Sir! Finally i understand
@Waaade1
@Waaade1 4 жыл бұрын
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
@karandoshi3121
@karandoshi3121 Жыл бұрын
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?
@DharmendraSingh-lq2rc
@DharmendraSingh-lq2rc 5 жыл бұрын
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.
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
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
@knssoftware6018
@knssoftware6018 5 жыл бұрын
@@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.
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
@@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.
@nolimitsREAL
@nolimitsREAL 5 жыл бұрын
@@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.
@merajulhasan5586
@merajulhasan5586 5 жыл бұрын
owesome, I am following all ur tutorials
@heatherbernstein
@heatherbernstein 3 жыл бұрын
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?
@bashirmanafikhi
@bashirmanafikhi 5 жыл бұрын
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??
@imikhan83
@imikhan83 5 жыл бұрын
you have to create a new child class with a relationship with the parent model.
@bashirmanafikhi
@bashirmanafikhi 5 жыл бұрын
@@imikhan83 It's hard to be understood 😅 I am sorry but thank you bro
@imikhan83
@imikhan83 5 жыл бұрын
@@bashirmanafikhi I wish I could help you more 🙂
@aznbuboa
@aznbuboa 4 жыл бұрын
Do we have to keep/maintain those migration files inside a project overtime?
@MrRanjitlove
@MrRanjitlove 5 жыл бұрын
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?
@meghabachu
@meghabachu 3 жыл бұрын
Here sync will not happen with model and db coumn. So u can't access new property.
@infinitegadgets3801
@infinitegadgets3801 Жыл бұрын
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 ?
@tushar1439
@tushar1439 4 жыл бұрын
For Dev env this migration way is good but how to move these changes to prod env ?
@abidtaqi3842
@abidtaqi3842 3 жыл бұрын
Awesome Just learnt it in one video!
@ualvarez95
@ualvarez95 4 жыл бұрын
What happend if I have data and then I remove the column with a new migration without this column?
@it-pro6803
@it-pro6803 3 жыл бұрын
I do have same question, Have you got answer?
@Testing-hq1ns
@Testing-hq1ns 5 жыл бұрын
Dear sir, How to change the column misspelled name with data? I mean that column contains some data.
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
Just rename the property, add a migration and update the db, the data will remain intact. Good luck
@InamiLanzhu
@InamiLanzhu 17 күн бұрын
Another awesome video!
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
You explain it so good!
@anshuljain720
@anshuljain720 4 жыл бұрын
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?
@TheFitCoiner
@TheFitCoiner 5 жыл бұрын
we are following you brother......keep the good work.
@abhishekbajpai9920
@abhishekbajpai9920 4 жыл бұрын
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?
@it-pro6803
@it-pro6803 3 жыл бұрын
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.
@bashirmanafikhi
@bashirmanafikhi 5 жыл бұрын
Thanks a lot I am waiting for the next video ♡
@balkishan2k11
@balkishan2k11 5 жыл бұрын
Can we go for binary data to upload file
@nahomwores3415
@nahomwores3415 2 жыл бұрын
Wow great explanation
@mohammedgadi884
@mohammedgadi884 5 жыл бұрын
Thanks for detail explaination
@karimkazia
@karimkazia 5 жыл бұрын
thank you Excellent video
@rayt6867
@rayt6867 5 жыл бұрын
Welcome back.
@sridevisweety3796
@sridevisweety3796 4 жыл бұрын
Hi Venkat can you look help please for this issue ''index was outside the bounds of the array."
@carlosinigo9225
@carlosinigo9225 4 жыл бұрын
This is amazing!
@VijayKumar-wy9ku
@VijayKumar-wy9ku 4 жыл бұрын
Superb!!
@StanBomin
@StanBomin 2 жыл бұрын
perfect thank you
@MmMm-tg5mq
@MmMm-tg5mq 5 жыл бұрын
Perfect
@yasirirfan5262
@yasirirfan5262 7 ай бұрын
Thank you so much
@codeautomate8155
@codeautomate8155 5 жыл бұрын
thank you
@AshutoshKumar-kt1dd
@AshutoshKumar-kt1dd 5 жыл бұрын
Great
@SyriaNabek7445
@SyriaNabek7445 2 жыл бұрын
Thanks alot
@robmays6982
@robmays6982 5 жыл бұрын
enjoyable
@shitalwalke9966
@shitalwalke9966 5 жыл бұрын
Nice
@josephregallis3394
@josephregallis3394 5 жыл бұрын
You need to make your video more than 360p. It's hard to see.
@saurabhchauhan232
@saurabhchauhan232 5 жыл бұрын
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
@Sysshad
@Sysshad 5 жыл бұрын
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
@arwahsapi
@arwahsapi 5 жыл бұрын
You can change the settings to 720p by clicking the gear icon on the video screen
@itstar8235
@itstar8235 5 жыл бұрын
First to View.
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
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
@DharmendraSingh-lq2rc
@DharmendraSingh-lq2rc 5 жыл бұрын
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.
@ljupconewman9357
@ljupconewman9357 5 жыл бұрын
@@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.
@DharmendraSingh-lq2rc
@DharmendraSingh-lq2rc 5 жыл бұрын
@@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
@ljupconewman9357 5 жыл бұрын
@@DharmendraSingh-lq2rc do some reading on enitity framework code first approach.
@DharmendraSingh-lq2rc
@DharmendraSingh-lq2rc 5 жыл бұрын
@@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.
@eugene-white-shark
@eugene-white-shark 3 жыл бұрын
Thank you
File upload in asp net core mvc
23:12
kudvenkat
Рет қаралды 189 М.
Repository pattern in asp net core
14:50
kudvenkat
Рет қаралды 308 М.
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Extend IdentityUser in ASP NET Core
10:52
kudvenkat
Рет қаралды 103 М.
AddSingleton vs AddScoped vs AddTransient
15:23
kudvenkat
Рет қаралды 217 М.
Using sql server with entity framework core
8:30
kudvenkat
Рет қаралды 222 М.
Custom validation attribute in asp net core
9:28
kudvenkat
Рет қаралды 67 М.
ASP NET Core model validation
10:19
kudvenkat
Рет қаралды 114 М.
Authorization in ASP NET Core
12:27
kudvenkat
Рет қаралды 169 М.
Edit role in asp net core
18:27
kudvenkat
Рет қаралды 69 М.
ASP NET Core Model Binding
12:31
kudvenkat
Рет қаралды 150 М.
ASP NET Core LogLevel configuration
15:45
kudvenkat
Рет қаралды 61 М.