Possible to use Tables of same type in Linq to SQL?
Posted
by Schneider
on Stack Overflow
See other posts from Stack Overflow
or by Schneider
Published on 2010-04-20T02:46:47Z
Indexed on
2010/04/20
2:53 UTC
Read the original article
Hit count: 270
linq-to-sql
Lets say I've got an object model, where I have many collections of the same type.
For example something like
class StockMarketData {
List<SummaryData> WeeklySummary;
List<SummaryData> MonthlySummary;
}
class SummaryData {
DateTime DateTime {get; set;}
double Value {get; set;}
}
Those lists will map onto database tables.
If you actually use L2S to generate a model from the database you will get something like:
class StockMarketData {
List<WeeklySummaryData> WeeklySummary;
List<MonthlySummaryData> MonthlySummary;
}
Even though WeeklySummaryData and MonthlySummaryData have the same shape.
Is it possible for Linq to SQL to create tables from a database of summary data, but get each table to contain the same type (such as shown in the top example).
© Stack Overflow or respective owner