public IDocumentMapping MappingFor(Type documentType) { return(_mappings.GetOrAdd(documentType, type => { return StoreOptions.AllDocumentMappings.SelectMany(x => x.SubClasses) .FirstOrDefault(x => x.DocumentType == type) as IDocumentMapping ?? StoreOptions.MappingFor(type); })); }
public ForeignKeyDefinition AddForeignKey(MemberInfo[] members, Type referenceType) { var referenceMapping = _storeOptions.MappingFor(referenceType); var duplicateField = DuplicateField(members); var foreignKey = new ForeignKeyDefinition(duplicateField.ColumnName, this, referenceMapping); ForeignKeys.Add(foreignKey); return(foreignKey); }
public void Add(IProjection projection) { if (projection == null) { throw new ArgumentNullException(nameof(projection)); } if (projection.Produces == null) { throw new InvalidOperationException("projection.Produces is null. Projection should defined the produced projection type."); } _options.MappingFor(projection.Produces); _projections.Add(projection); }
public IDocumentMapping MappingFor(Type documentType) { return(_mappings.GetOrAdd(documentType, type => { if (type == typeof(EventStream)) { return StoreOptions.Events.As <IDocumentMapping>(); } return StoreOptions.Events.AllEvents().FirstOrDefault(x => x.DocumentType == type) ?? StoreOptions.AllDocumentMappings.SelectMany(x => x.SubClasses) .FirstOrDefault(x => x.DocumentType == type) as IDocumentMapping ?? StoreOptions.MappingFor(type); })); }
public void Add(IProjection projection) { _options.MappingFor(projection.Produces); _projections.Add(projection); }