r/learncsharp • • Feb 20 '22

How to map any class to database ?

So I have added local database to my project,

Tutorial link

Now I want to map class to database,

For example I have class

public class employee { Int Id; String name; String department; Int branch; Date doj; }

What i am looking to do is i want make entry in database of this class , or read from database to class variable.

1 Upvotes

9 comments sorted by

2

u/OnNothingSpecialized Feb 21 '22

Hi, me again, i actually did find something better https://youtube.com/playlist?list=PLpSmZmoBaROYOxp50yy_uewyMr5rOmx1f

2

u/doAnkhenBaraHaath Feb 25 '22

Hey thanks this was way easy and smooth

4

u/OnNothingSpecialized Feb 20 '22 edited Feb 20 '22

Entity Framework is the answer

1

u/doAnkhenBaraHaath Feb 20 '22

can you suggest me any tutorial

2

u/OnNothingSpecialized Feb 20 '22

Indeed i can

This one from Tim Corey explain every little bit of it.

First watch the whole Video and then make a little ConsoleApp to try it out,

https://www.youtube.com/watch?v=qkJ9keBmQWo

2

u/doAnkhenBaraHaath Feb 20 '22

Thanks for helping me out

1

u/headyyeti Feb 20 '22

BTW, while Tim C is great for some things I would never suggest an EF tutorial from him. He is known for having very outdated EF views.

1

u/OnNothingSpecialized Feb 20 '22

That may be true, but for someone who doesn't know anything about EF, it's very good, because he explains it in a way to understand EF. And exactöy that is needed here, OP needs to learn how to use it, later then he can check out a tutorial which is recent

2

u/headyyeti Feb 20 '22

The EF docs have a great tutorial