I have an abstract EventBase class and some inherited event types, along with an Event class. Each event type has its own unique columns.
In my data layer, I have a GetEvents method that simply does:
from e in db.Events
select new Event {...values...};
EventType is an enum which matches up to an EventTypes table
I want GetEvents(EventType type) and GetEvent(int id, EventType type) to do something like..
from e in GetEvents()
where e.TypeId == (int)type
select new TypeSpecified {...values for Event + Type-specific fields...};
// Determine what type it is
// Switch statement? Dictionary?
I'm not sure a switch is the best idea, but I'm also not sure how to correctly employ a dictionary to map the data retrieval and object creation to a specific type.
My second question involves saving the data - going from Business Object to L2S table - same question as above, basically
I hope this makes sense :)