Is it possible to specify database and schema in linqtosql query?

I am using linqtosql to query the database directly (not as am ORM).

I have the following code that works:

var events = 
    from e in Events
    select e.EventID;

      

I would like to extend it to join a second table in a different database / schema in the same SQL instance. For example:

var events = 
    from e in Events
    join p in database2.dbo.People on p.PersonID equals e.PersonID 
    select e.EventID;

      

How would I like to specify the database / schema in a linq query?

+3


source to share


1 answer


I don't think this is possible out of the box. But if you only want to choose, you can create a view to a second database and add that to your DBML.



+1


source







All Articles