void InitializeDocumentStore()
{
_documentStore = _configuration.CreateDocumentStore();
var keyGenerator = new SequentialKeyGenerator(_documentStore);
_documentStore.Conventions.DocumentKeyGenerator = (a,b,c) => string.Format("{0}/{1}", CollectionName, keyGenerator.NextFor<IEvent>());
//_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<long>());
//_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<int>());
//_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<string>());
//_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<Guid>());
//_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<short>());
_documentStore.Conventions.CustomizeJsonSerializer = s =>
{
s.Converters.Add(new MethodInfoConverter());
s.Converters.Add(new EventSourceVersionConverter());
s.Converters.Add(new ConceptConverter());
};
var originalFindTypeTagNam = _documentStore.Conventions.FindTypeTagName;
_documentStore.Conventions.FindTypeTagName = t =>
{
if (t.HasInterface<IEvent>() || t == typeof(IEvent)) return CollectionName;
return originalFindTypeTagNam(t);
};
_documentStore.RegisterListener(new EventMetaDataListener(_eventMigrationHierarchyManager));
}