-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration Schema (for version 1.4.0 and below)
Fabio Gouw edited this page Dec 21, 2020
·
1 revision
Here's an example of the configuration schema provided by NHilo to customize the behavior of the key generation. However, you do not need to put this configuration section in your app.config. NHilo will use default values when the configuration is not available.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhilo" type="NHiLo.Common.KeyGeneratorConfig, NHiLo"/>
</configSections>
<connectionStrings>
<add name="DB1" connectionString="Server=.\SQLEXPRESS;Database=APTO;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>
<add name="DB2" connectionString="Server=localhost;Database=test_nhilo;Uid=root;Pwd=secret;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<nhilo>
<hiloKeyGenerator connectionStringId="DB1" createHiLoStructureIfNotExists="true" defaultMaxLo="10" storageType="Sequence" objectPrefix="SQXX_">
<entities>
<add name="xpto1" maxLo="100" />
<add name="xpto2" maxLo="66" />
</entities>
</hiloKeyGenerator>
</nhilo>
</configuration>
-
nhilo is the root of the NHilo's configuration section
- hiloKeyGenerator groups the configuration for the hilo algorithm
- connectionStringId is an optional attribute that defines which connection string will be used to locate the database where NHilo will store the values of the "hi" number for the entities. If this information is not provided, then the last connection string will be used.
- createHiLoStructureIfNotExists is an optional attribute that tell NHilo to try to create the table used for storing the "hi" numbers. Default is true.
- defaultMaxLo is the default value for the "lo" part of the key. Its also optional with a default value of 100.
- storageType for SQL Server, defines if the hi values will be stored in the database using tables (the default option) or sequences.
- objectPrefix for SQL Server and sequences, defines the prefix of the names of the sequences. The default value is "SQ_HiLo_".
-
entities groups the configuration of each entity. It's optional too.
- name is the name of the entity which this configuration will be applied.
- maxLo is the max "lo" number for the given entity.