Created
July 20, 2016 22:12
-
-
Save cathode/85b54b7294c97bf1c1026b802c99d987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Query object mappings to find objects that should be active. | |
| var active = context.Objects | |
| .Join(context.ObjectSets | |
| .Join(context.Databases | |
| .Where(e => e.Environment == this.CurrentEnvironment), | |
| set => set.DatabaseId, | |
| database => database.DatabaseId, | |
| (set, database) => new | |
| { | |
| ObjectSetId = set.ObjectSetId, | |
| SetName = set.Name, | |
| DatabaseId = database.DatabaseId, | |
| //Environment = database.Environment, | |
| DatabaseName = database.Name, | |
| FilePath = database.FilePath, | |
| ConnectionString = database.ConnectionString | |
| }), | |
| obj => obj.ObjectSetId, | |
| dset => dset.ObjectSetId, | |
| (obj, dset) => new | |
| { | |
| ObjectId = obj.ObjectId, | |
| ObjectType = obj.ObjectType, | |
| ObjectName = obj.ObjectName, | |
| PrimaryKeyColumn = obj.PrimaryKeyColumn, | |
| FilePath = dset.FilePath, | |
| ConnectionString = dset.ConnectionString | |
| }) | |
| .Join(context.ObjectMappings | |
| .Where(m => this.CurrentApplications.Contains(m.ApplicationId)), | |
| obj => obj.ObjectId, | |
| map => map.ObjectId, | |
| (obj, map) => new | |
| { | |
| ObjectId = obj.ObjectId, | |
| ObjectType = obj.ObjectType, | |
| ObjectName = obj.ObjectName, | |
| PrimaryKeyColumn = obj.PrimaryKeyColumn, | |
| FilePath = obj.FilePath, | |
| ConnectionString = obj.ConnectionString, | |
| ObjectAlias = map.ObjectAlias, | |
| MappingType = map.MappingType | |
| }).Distinct(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment