im trying to grasp LINQ as I understand it LINQ will be your DAL to your db which in turn creates for you automatically a class that maps out your db structure for you and then you can perform queries using that class ..
am I correct in my assumption ?? please do enlighten me
"Linq" is not an ORM technology, it is simply a way to write query like statements inside of .Net languages. You have not said whether you are using Ling to SQL or Linq to Entities, which are both ORM technolgies that work with Linq to map your data schema to tables.
Linq to SQL will provide you with a straight mapping of every table to a class, and will handle most of the lifting to get this done. Your queries can return these types, or using your Linq expression you can "project" these types to other types that you have made yourself.
If you need more flexibility, Entity Framework will allow you to map a single table to multiple entities, multiple tables to a single entity, etc. To do this you have to do a lot more work on your own, since you have to modify the mapping by hand in many cases. Similar to Linq to SQL, queries can return either these generated types or specify their own types in query.
By default, the Linq to SQL designer will create a class for each table in your database. The database context object that is created will have a definition for each table in your database. You can execute Linq queries against those table definitions and store the results in the generated classes, you have your queries generate anonymous types. It's up to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With