How to enable Intellisense for CodeFluent Entities runtime configuration?
CodeFluent Entities generated code can be configured using the application configuration file (App.config or web.config):
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="Sample" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" /> </configSections> <Sample connectionString="<connection string>" useDateTime2="true" /> </configuration>
The configuration section is describe in the documentation: http://www.softfluent.com/documentation/BOM_ApplicationConfiguration.html.
This section is not known by Visual Studio, so you may have the following message:
In fact Visual Studio doesn’t have an XML schema for this section and so it can’t validate it. At the same time we cannot provide a generic schema as the section name is Project specific. So the solution is to use The Template producer which will generate the XML schema based on the information from your Project.
Download the following template from GitHub and include it in your project : https://github.com/SoftFluent/CodeFluent-Entities/tree/master/Extensions/CodeFluent%20Configuration%20Section%20Template
Add a template producer
- Build the model
- Open the app.config or web.config file and add the following xml attributes (replace <Default namespace> by your project default namespace)
xsi:schemaLocation=”http://www.softfluent.com/<Default Namespace>/CodeFluentConfiguration.xsd CodeFluentConfiguration.xsd”>
You should now have auto-completion of the CodeFluent Entities configuration section.
Note: this xml schema includes only most common settings. If you think we forgot some useful settings, please leave a comment.
The R&D Team