LLBLGen Pro Support System Custom Templates feed https://llblgen.com/tinyforum//Forum/19 This is the RSS feed for the forum Custom Templates on the LLBLGen Pro Support System forum system. 30 en-us Docs for custom importer? by Otis <p>No you're not missing something, the documentation refers to docs in the SDK we didn't include. We initially had planned for including documentation how to write an importer but it turned out to be a lot of work for something that would likely be used very rarely. </p> <p>We ship the importers we included in the designer as sourcecode with comments which should get people started if they ever want to build an importer plugin. the llblgen pro project importer is likely the wisest choice to look at if you want to build one. </p> <p>In general it uses 2 phases, phase 1 and phase 2. Phase 1 is for collecting the data that's potentially there so the user can select which data to import. Phase 2 is for collecting the data to import based on the user's selection. </p> Otis https://llblgen.com/tinyforum/Thread/28753#152932 Fri, 08 Sep 2023 08:01:13 GMT Docs for custom importer? https://llblgen.com/tinyforum/Thread/28753#152932 Docs for custom importer? by timbered <p>The documentation for the importer says:</p> <p>&quot;The SDK documentation contains more details about how importer plug-ins work and how you can create them yourself to create importers for other data, e.g. xml file based data.&quot;</p> <p>In the SDK, I see plenty of documentation for templates and type converters, but nothing for importers.</p> <p>Am I missing something? </p> timbered https://llblgen.com/tinyforum/Thread/28753#152931 Thu, 07 Sep 2023 19:00:12 GMT Docs for custom importer? https://llblgen.com/tinyforum/Thread/28753#152931 CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 by Zaudio <blockquote><p class="quote-nickname">Otis wrote:</p> <p>This was a breaking change in v5.8: <a href="https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/migratingcode.htm#breaking-changes-v5.8" rel="nofollow">https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/migratingcode.htm#breaking-changes-v5.8</a>. Please see this link for how to correct your code.</p> <p>Btw, our runtime does support hints too (QuerySpec / Linq), not sure if that could help too.. <a href="https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/QuerySpec/gencode_queryspec_generalusage.htm#specifying-query--optimizer-hints-sql-server-mysql-oracle" rel="nofollow">https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/QuerySpec/gencode_queryspec_generalusage.htm#specifying-query--optimizer-hints-sql-server-mysql-oracle</a></p> </blockquote> <p>Thanks Otis, just what I was looking for.</p> <p>Simon</p> Zaudio https://llblgen.com/tinyforum/Thread/28687#152528 Tue, 21 Mar 2023 14:35:30 GMT CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 https://llblgen.com/tinyforum/Thread/28687#152528 CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 by Otis <p>This was a breaking change in v5.8: <a href="https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/migratingcode.htm#breaking-changes-v5.8" rel="nofollow">https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/migratingcode.htm#breaking-changes-v5.8</a>. Please see this link for how to correct your code.</p> <p>Btw, our runtime does support hints too (QuerySpec / Linq), not sure if that could help too.. <a href="https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/QuerySpec/gencode_queryspec_generalusage.htm#specifying-query--optimizer-hints-sql-server-mysql-oracle" rel="nofollow">https://www.llblgen.com/Documentation/5.10/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/QuerySpec/gencode_queryspec_generalusage.htm#specifying-query--optimizer-hints-sql-server-mysql-oracle</a></p> Otis https://llblgen.com/tinyforum/Thread/28687#152527 Tue, 21 Mar 2023 07:40:46 GMT CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 https://llblgen.com/tinyforum/Thread/28687#152527 CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 by Zaudio <p>Hi, We are now using Adapter for .net6 with 5.10, and a few simple custom templates. We previously used adapter for netstandard2.1 with +5.7</p> <p>We extended our DataAccessAdapter using a partial class (so not strictly a custom templates problem), and have used this override to date to add query hints certain queries:</p> <pre><code class="cs"> protected override IRetrievalQuery CreateSelectDQ(QueryParameters parameters) { var result = base.CreateSelectDQ(parameters); switch (AddQueryOption) { case QueryOption.OptimizeForUnknown: result.Command.CommandText += @&quot; OPTION (OPTIMIZE FOR UNKNOWN)&quot;; break; case QueryOption.Recompile: result.Command.CommandText += @&quot; OPTION (RECOMPILE)&quot;; break; } return result; } </code></pre> <p>After updating to 5.10, this is broken, as the CreateSelectDQ method no longer exists to override. Please advise how to update our code to continue to use this additional functionality.</p> <p>Thanks Simon</p> Zaudio https://llblgen.com/tinyforum/Thread/28687#152525 Mon, 20 Mar 2023 22:03:48 GMT CreateSelectDQ no longer present in DataAccessAdapterCore after upgradef rom 5.7 to 5.10 https://llblgen.com/tinyforum/Thread/28687#152525 ConfigFileHelper.ReadConnectionString locations by WilliamB <p>Thank you. for your answers and suggestions. The error was &quot;Invalid connection string&quot; since the connection string is an empty string once reaches the line that should open the Connection.</p> <p>Thank you Otis. Your answer was very clarifying. </p> WilliamB https://llblgen.com/tinyforum/Thread/27502#150508 Tue, 01 Mar 2022 12:12:28 GMT ConfigFileHelper.ReadConnectionString locations https://llblgen.com/tinyforum/Thread/27502#150508 ConfigFileHelper.ReadConnectionString locations by Otis <p>You're trying to execute code meant for runtime during template generation. That's not how this works. Connection strings are obtained from the project. See this app.config template from the EF 6 template set:</p> <pre><code class="xml">&lt;% Project currentProject = _executingGenerator.ProjectDefinition; %&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;configuration&gt; &lt;connectionStrings&gt; &lt;!-- please adjust the connection string embedded in the element below to target the proper catalog / server using the proper user / password combination --&gt; &lt;add name=&quot;&lt;%=currentProject.CreateConnectionStringKeyNameForDatabase(_executingGenerator.DriverID)%&gt;&quot; connectionString=&quot;metadata=res://*/&lt;%=_executingGenerator.ActiveSourceElementsContainerName%&gt;.csdl|res://*/&lt;%=_executingGenerator.ActiveSourceElementsContainerName%&gt;.ssdl|res://*/&lt;%=_executingGenerator.ActiveSourceElementsContainerName%&gt;.msl;provider=&lt;%=SD_EF_GeneralUtils.DriverIdToProviderName(_executingGenerator.DriverID)%&gt;;provider connection string=&amp;quot;&lt;%=currentProject.CreateConnectionStringForDatabase(_executingGenerator.DriverID)%&gt;&amp;quot;&quot; providerName=&quot;System.Data.EntityClient&quot; /&gt; &lt;/connectionStrings&gt; &lt;/configuration&gt; </code></pre> <p>Please also don't use <code>__outputwriter</code> in your template. Use <code>&lt;%=variable%&gt;</code></p> Otis https://llblgen.com/tinyforum/Thread/27502#150507 Tue, 01 Mar 2022 08:10:04 GMT ConfigFileHelper.ReadConnectionString locations https://llblgen.com/tinyforum/Thread/27502#150507 ConfigFileHelper.ReadConnectionString locations by Walaa <p>Please provide the error you are getting?</p> Walaa https://llblgen.com/tinyforum/Thread/27502#150504 Mon, 28 Feb 2022 21:18:21 GMT ConfigFileHelper.ReadConnectionString locations https://llblgen.com/tinyforum/Thread/27502#150504 ConfigFileHelper.ReadConnectionString locations by WilliamB <p>Thanks Otis, </p> <p>The error I am getting is not launched while using the generated code, but while generating the code. </p> <p>Here is the task defined:</p> <pre><code class="xml">&lt;task name=&quot;uFACTS.Tasks.Common.Utility.General.MsgDefClassGenerator&quot; assemblyFilename=&quot;SD.LLBLGen.Pro.TaskPerformers.dll&quot; taskPerformerClass=&quot;SD.LLBLGen.Pro.TaskPerformers.CodeEmitter&quot; description=&quot;Generates the MsgDef static classes&quot; isOptional=&quot;true&quot;&gt; &lt;supportedPlatforms/&gt; &lt;supportedTemplateGroups/&gt; &lt;dependencies/&gt; &lt;parameters&gt; &lt;parameter name=&quot;destinationFolder&quot; defaultValue=&quot;&quot; isOptional=&quot;false&quot; description=&quot;The folder to generate the code in&quot;/&gt; &lt;parameter name=&quot;filenameFormat&quot; defaultValue=&quot;MsgDefType.[extension]&quot; isOptional=&quot;false&quot; description=&quot;The destination file format specification&quot;/&gt; &lt;parameter name=&quot;templateID&quot; defaultValue=&quot;uFACTS_MsgDefTypeTemplate&quot; isOptional=&quot;false&quot; description=&quot;The ID of the template to use.&quot; valueType=&quot;templateID&quot;/&gt; &lt;parameter name=&quot;emitType&quot; defaultValue=&quot;generic&quot; isOptional=&quot;false&quot; description=&quot;The type of code generation to perform.&quot; valueType=&quot;emitType&quot;/&gt; &lt;parameter name=&quot;templateBindingDefinitionName&quot; defaultValue=&quot;&quot; isOptional=&quot;true&quot; description=&quot;The name of the TemplateBindings from which to pick the templateID specified. Specifying this parameter will always force the templateID to be picked from the templateBindings with the name specified.&quot;/&gt; &lt;parameter name=&quot;failWhenExistent&quot; defaultValue=&quot;false&quot; isOptional=&quot;true&quot; description=&quot;Flag to signal what to do when the destination file already exists.&quot; valueType=&quot;boolean&quot;/&gt; &lt;/parameters&gt; &lt;/task&gt;` </code></pre> <p>...and here are the content of the templates</p> <p><strong>MsgDefTypeTemplate</strong></p> <pre class="nocode">namespace uFACTS.Utility.General { &lt;# uFACTS_MsgDefType_GetTypes #&gt; } </pre><p><strong>MsgDefType_GetTypes</strong></p> <pre class="nocode">&lt;[ System.Diagnostics ]&gt; &lt;% //Debugger.Break(); Hashtable groups = new Hashtable(); const string ConnectionKeyString = &quot;Main.ConnectionString&quot;; OracleConnection conn = new OracleConnection(SD.LLBLGen.Pro.ORMSupportClasses.ConfigFileHelper.ReadConnectionStringFromConfig(ConnectionKeyString)); conn.Open(); OracleCommand cmd = new OracleCommand(&quot;select msg_def_nu, const_na, msg_desc, msg_text from ui_msg_def order by msg_def_nu&quot;, conn); OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string group = string.Empty; string name = reader[&quot;const_na&quot;].ToString(); if (!name.Contains(&quot;.&quot;)) { group = &quot;General&quot;; } else { group = name.Substring(0, name.IndexOf(&quot;.&quot;)); name = name.Substring(name.IndexOf(&quot;.&quot;) + 1); } if (!groups.Contains(group)) { groups.Add(group, new List&lt;string&gt;()); } string tmp = &quot;\t\tpublic const int &quot; + name + &quot; = &quot; + reader[&quot;msg_def_nu&quot;].ToString() + &quot;;&quot;; tmp = tmp.PadRight(50, ' '); tmp += &quot;// &quot; + reader[&quot;msg_desc&quot;].ToString().Replace(&quot;\r\n&quot;, &quot;\n&quot;).Replace(&quot;\n&quot;, &quot; &quot;) + &quot; - \&quot;&quot; + reader[&quot;msg_text&quot;].ToString().Replace(&quot;\r\n&quot;, &quot;\n&quot;).Replace(&quot;\n&quot;, &quot; &quot;) + &quot;\&quot;\r\n&quot;; ((List&lt;string&gt;)groups[group]).Add(tmp); } reader.Close(); conn.Close(); foreach (DictionaryEntry de in groups) { string output = string.Empty; output += &quot;\tpublic static partial class MD&quot;+de.Key.ToString()+&quot;\r\n&quot;; output += &quot;\t{\r\n&quot;; ((List&lt;string&gt;)de.Value).Sort(); foreach (string val in (List&lt;string&gt;)de.Value) { output += val; } output += &quot;\t}\r\n\r\n&quot;; __outputWriter.Write(output); } %&gt; </pre><p>The problem being the connection string is empty string when conn.Open() is called.</p> WilliamB https://llblgen.com/tinyforum/Thread/27502#150496 Mon, 28 Feb 2022 13:36:05 GMT ConfigFileHelper.ReadConnectionString locations https://llblgen.com/tinyforum/Thread/27502#150496 ConfigFileHelper.ReadConnectionString locations by Otis <p>the config file is the config file of the application, which is a netfx term, so app/web.config. If you're on .netcore/.net5+ then you need to use the RuntimeConfiguration system, which is specifying the connection string in code. <a href="https://www.llblgen.com/Documentation/5.9/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_runtimeconfiguration.htm" rel="nofollow">https://www.llblgen.com/Documentation/5.9/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_runtimeconfiguration.htm</a></p> Otis https://llblgen.com/tinyforum/Thread/27502#150495 Sun, 27 Feb 2022 08:20:10 GMT ConfigFileHelper.ReadConnectionString locations https://llblgen.com/tinyforum/Thread/27502#150495