I have two log tables in seperate SQL Server databases (on different servers). The two tables have exactly the same schema. In my .NET application I can create two Linq to SQL class collections (DBML files) and then do my own custom Linq queries to union the two tables and return an anonymous type. But I have several queries (all slightly different) on the same tables and doing the unions every time is repetitive.
Is it possible to union the two tables into a single concrete/named type IEnumerable? Basically what I'd like to do is something like:
var logs = Logs.Where(l => l.TimeStart >= DateTime.Today)
And have Logs
actually return data from two tables and have sensible queries sent to the two database servers no matter what I put in the .Where()
.
Is this possible?