Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Configurations

Daniel Wertheim edited this page Nov 29, 2012 · 5 revisions

To make life simpler, as of v12.0, there's a Configuration namespace that you could include to ease switching parts out and to configure the database.

Example

using SisoDb.Configurations;
db.Configure()
    .UseAutoIds()
    .PreserveIds()
    .UseManualIds()
    .UseGuidStructureIdGeneratorResolvedBy(structureSchema => new MyCustomGuidIdGenerator())
    .UseSerializer(new MyCustomSerializer())
    .UseCacheProvider(new MyCustomCacheProvider())
    .StructureType<Foo>(cfg => cfg.AllowNestedStructures())
    .StructureType<Bar>(cfg => cfg.OnlyIndexThis(x => x.Key))
    .ForProduction();

UseAutoIds

If an Id exists it will be left untouched, otherwise a new ID will be generated.

PreserveIds

GUID and String Ids should have been assigned. Identities will be generated for you.

UseManualIds

No Ids will be generated. You are responsible for doing it.

UseGuidStructureIdGeneratorResolvedBy

Lets you hook in a Func that determines which StructureIdGenerator to use for GUIDs. You also get the StructureSchema so that you can do this per type.

UseSerializer

Basically just assigns a new serializer to the Db.

UseCacheProvider

Basically just assigns a new cache-provider to the Db.

StructureType

Allows you to manually control how certain structures should be indexed.

ForProduction

Will not allow upsert of new tables nor will it perform any synchronization of schema changes. It does this by setting values on settings described here.

Clone this wiki locally