public static DbsetDialogResult ShowDialog(ProjectItem prjItem, CodeClass2 cls, string[] existingSets) { var dlg = new DbsetDialog { ProjectItem = prjItem, ContextClass = cls , _existingSets = existingSets}; dlg.Init(); dlg.ShowDialog(); return dlg._isGenerated ? new DbsetDialogResult(dlg.CandidateList.SelectedItems.Cast<DbsetCandidate>().ToArray(),true) : null; }
public static IEnumerable <CodeClass2> GetClassesWithAttribute(this ProjectItem item, Type attribute) { var fullName = attribute.DottedFullName(); // all attributes is in class attribute var res = item.GetClassesEx().Where(cclass => cclass.Attributes.Cast <CodeAttribute>().Any(x => x.FullName == fullName)); return(res); }
public static IEnumerable <CodeClass2> GetClassesWithAttributes(this ProjectItem item, Type[] attributes) { //Replace nested class + delimiter into . as the format used in CodeAttribute.FullName var fullNames = attributes.Select(x => x.DottedFullName()).ToArray(); var res = item.GetClassesEx().Where(cclass => fullNames.All(attrName => cclass.Attributes.Cast <CodeAttribute>().Any(cAttr => cAttr.FullName == attrName))); return(res); }
//private static readonly ConcurrentDictionary<CodeClass, Type> ToPropertyInfo_classCache = new ConcurrentDictionary<CodeClass, Type>(); //private static readonly Type GetGeneratorAttribute_type = typeof(GeneratorOptionAttribute); public static IEnumerable <CodeClass2> GetClassesEx(this ProjectItem item) { var classes = item.GetClasses().Values.SelectMany(x => x).Cast <CodeClass2>(); return(classes); }