public void InitForQuery(Document queryDoc) { tiny = TinyIoCContainer.Current; queryHasRun = false; this.queryDoc = queryDoc; dte = queryDoc.DTE; query = new Query(this); _config = _configResolver.GetConfig(queryDoc.FullName, query.Text); if (string.IsNullOrEmpty(Config.DefaultConnection)) { return; // absence will be picked up in conductor. Not fabulous. } provider = tiny.Resolve <IProvider>(Config.Provider); // resolving the target project item for code generation. We know the file name, we loop through child items of the query til we find it. var target = Conductor.GetItemByFilename(queryDoc.ProjectItem.ProjectItems, GeneratedClassFullFilename); if (target == null) { // .net core has a little problem with nested items. target = Conductor.GetItemByFilename(queryDoc.ProjectItem.ContainingProject.ProjectItems, GeneratedClassFullFilename); } _putCodeHere = new PutCodeHere(target); string currDir = Path.GetDirectoryName(queryDoc.FullName); }
// constructor public CodeGenerationContext(Document queryDoc) { tiny = TinyIoCContainer.Current; queryHasRun = false; this.queryDoc = queryDoc; dte = queryDoc.DTE; query = new Query(this); provider = tiny.Resolve <IProvider>(DesignTimeConnectionString.v.ProviderName); provider.Initialize(DesignTimeConnectionString.v); // resolving the target project item for code generation. We know the file name, we loop through child items of the query til we find it. _putCodeHere = new PutCodeHere(Conductor.GetItemByFilename(queryDoc.ProjectItem.ProjectItems, GeneratedClassFullFilename)); string currDir = Path.GetDirectoryName(queryDoc.FullName); hlpr = new AdoSchemaFetcher(); }
// constructor public CodeGenerationContext(Document queryDoc) { tiny = TinyIoCContainer.Current; queryHasRun = false; this.queryDoc = queryDoc; dte = queryDoc.DTE; query = new Query(this); provider = tiny.Resolve <IProvider>(DesignTimeConnectionString.ProviderName); provider.Initialize(DesignTimeConnectionString); // resolving the target project item for code generation. We know the file name, we loop through child items of the query til we find it. _putCodeHere = new PutCodeHere(Conductor.GetItemByFilename(queryDoc.ProjectItem.ProjectItems, GeneratedClassFullFilename)); string currDir = Path.GetDirectoryName(queryDoc.FullName); //WriteToOutput("\nprocessing " + queryDoc.FullName ); // class name and namespace read from user's half of partial class. //QfClassName = Regex.Match(query, "(?im)^--QfClassName\\s*=\\s*(\\S+)").Groups[1].Value; //QfNamespace = Regex.Match(query, "(?im)^--QfNamespace\\s*=\\s*(\\S+)").Groups[1].Value; // doc.fullname started being lowercase ?? //namespaceAndClassNames = GetNamespaceAndClassNames(resultsClass); hlpr = new AdoSchemaFetcher(); }