I am trying to create a CQLinq query which will give me all types and/or members from a specific assembly that is being used by the rest of the solution.
I need this information so I can move/refactor all the referenced types/members and in the end remove the specific assembly (and all references to it) from the solution.
For optimal result presentation, the query can look like:
let targets = Assemblies.WithName("SpecificAssemblyName").Single().ChildTypesAndMembers.ToHashSet()
let methodsUser = Application.Methods.UsingAny(targets)
let typesUser = Application.Types.UsingAny(targets)
from x in ((IEnumerable<IMember>)typesUser).Concat(methodsUser)
where !targets.Contains(x)
select new {
x,
called = x.IsMethod ? x.AsMethod.MethodsCalled.Intersect(targets).Concat(x.AsMethod.FieldsUsed.Intersect(targets)) :
x.AsType.TypesUsed.Intersect(targets)}