mardi 25 juin 2019

Getting assemblies with classname "Entity" from build folder

I want to get the Assemblies with containing in the classname Entity. For example ProductEntity sould be in the returned assembly

Currently I am getting all the assemblies from AppDomain.CurrentDomain.GetAssemblies(); I filter those with link and after that i am trying to get the Class name with Assembly.GetType().Name This returns me a array with "runtimeAssembly" in it and nothing else.

var assemblyFromClass = (from asm in AppDomain.CurrentDomain.GetAssemblies()
                               from type in asm.GetTypes()
                               where type.IsClass && type.Name.Contains("Entity") &&
                                      asm.ManifestModule.Name != "<In Memory Module>"
                                          && !asm.FullName.StartsWith("System")
                                          && !asm.FullName.StartsWith("Microsoft")
                                          && asm.Location.IndexOf("App_Web") == -1
                                          && asm.Location.IndexOf("App_global") == -1
                                          && asm.FullName.IndexOf("CppCodeProvider") == -1
                                          && asm.FullName.IndexOf("WebMatrix") == -1
                                          && asm.FullName.IndexOf("SMDiagnostics") == -1
                                          && !String.IsNullOrEmpty(asm.Location)
                               select asm.GetType().FullName).ToList(); 

https://gyazo.com/e8687c49073ac3f46e0def8e927cc314

This is what i get back. Im expecting ProductEntity, BlablaEntity Etc





Aucun commentaire:

Enregistrer un commentaire