This project has moved. For the latest updates, please go here.
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" ?>
    <section name="nhilo" type="NHiLo.Common.KeyGeneratorConfig, NHiLo"/>
    <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"/>
    <hiloKeyGenerator connectionStringId="DB1" createHiLoStructureIfNotExists="true" defaultMaxLo="10">
        <add name="xpto1" maxLo="100" />
        <add name="xpto2" maxLo="66" />
  • 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.
    • 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.

Last edited Dec 15, 2012 at 1:03 AM by fabiogouw, version 1


No comments yet.