Is it possible to set initial value for standard int64-key generator otherwise than just direct sql query?

asked Apr 24 at 02:43

Fomin%20Dmitry's gravatar image

Fomin Dmitry

One Answer:

Hello Dmitry,

There are settings in DomainConfiguration where you can specify certain seed and cache size for particular generator. It is possible to do whether in code or in configuration file.

In code:

var domainConfiguration = new DomainConfiguration("sqlserver://localhost/DO-Tests?MultipleActiveResultSets=True");
domainConfiguration.KeyGenerators.Add(new KeyGeneratorConfiguration("Int64"){CacheSize = 128, Seed = 128});// the "-Generator" postfix is not needed

In configuration file

<domain name="Default" connectionUrl = "sqlserver://localhost/DO-Tests?MultipleActiveResultSets=True">
    <keyGenerator name="Int64" seed="128" cacheSize="128"/>

answered Apr 24 at 05:40

Alexey%20Kulakov's gravatar image

Alexey Kulakov

Thank you for your answer. It seems like key seed initialization works only when you first time builds db shema on clean database.

(Apr 24 at 18:34) Fomin Dmitry Fomin%20Dmitry's gravatar image

In which upgrade modes do you build Domain?

(Apr 25 at 00:22) Alexey Kulakov Alexey%20Kulakov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA