LINQ2SQL is pretty good. Easy to build entity classes and use it.
but what if I don’t know at compile time nothing about the database, and tables?
but I need to query “Foo” table in “FooDb”;
Can I run Linq queries against a DB without any Entity classes?
Could you show me an example?
Linq2Sql is an ORM – an Object Relational Mapper.
As such, it needs to know the database structure in order to generate classes that you can interact with, before your application is compiled.
In short, what you are asking is not possible with Linq2Sql or any other ORM I know of.
You can create an application that will query the system tables and generate and load classes for you, but I wouldn’t know how you would interact with them in code without knowing the structures in advance.