another Linq questions for you smart folks...!

I

Ilyas

Hi all

I have a database that contains several tables. Each table has the
name data01, data02, data03 etc

The column definitions for each table all contains several standard
columns and then several custom columns. There are no foreign keys or
anything like that!

My questions is it it possible to use "linq to sql" in this scenario
to: Allow me to retreieve data from each "data" table, and get back a
strongly typed object? How would this work for the custom columns that
are defined on each linq table. Furthermore any new tables would I be
be to use Linq to sql against them? New tables are created by
different applications and I have no controls over this aspect

If its not possible to use Linq, what other options do I have to get
access to the data to perform simple crud operations?

Many thanks
 
M

Marc Gravell

I think at this point any benefit from LINQ would be lost; if the
tables were the same (or you only cared about the fixed part) you
could *just about* use an XmlMappingSource and a single type (with
different mappings each time), but you'd have to talk to each table in
a different data-context. Other than that, you're into dynamic type
generation (through any of: reflection, CodeDom, dynamic compilation,
etc) - which is not an area to be taken lightly.

Now; I am not a fan of DataTable etc - but in this case, I suspect
that this will be your most pragmatic option... i.e. have an (untyped)
DataSet, to which you add the necessary tables, each with the
necessary columns. Ditto adapters...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top