public string[] AllSchemaNames() { var schemas = AllMappings.OfType <DocumentMapping>().Select(x => x.DatabaseSchemaName).Distinct().ToList(); schemas.Fill(StoreOptions.DatabaseSchemaName); schemas.Fill(StoreOptions.Events.DatabaseSchemaName); var schemaNames = schemas.Select(x => x.ToLowerInvariant()).ToArray(); return(schemaNames); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { AllMappings.SetMaps(modelBuilder); // modelBuilder.Conventions.Remove <PluralizingTableNameConvention>(); modelBuilder.Conventions.Remove <ManyToManyCascadeDeleteConvention>(); modelBuilder.Conventions.Remove <OneToManyCascadeDeleteConvention>(); // //modelBuilder.Entity<UserNotification>().HasKey(un => new { un.UserId, un.NotifyId }); //modelBuilder.Entity<User>() // .HasMany(x => x.UserNotifications) // .WithOptional() // .HasForeignKey(x => x.UserId); //modelBuilder.Entity<Notification>() // .HasMany(x => x.UserNotifications) // .WithOptional() // .HasForeignKey(x => x.NotifyId); }
public IEnumerable <ISchemaObjects> AllSchemaObjects() { var mappings = AllMappings.OrderBy(x => x.DocumentType.Name).TopologicalSort(m => { var documentMapping = m as DocumentMapping; if (documentMapping == null) { return(Enumerable.Empty <IDocumentMapping>()); } return(documentMapping.ForeignKeys .Where(x => x.ReferenceDocumentType != documentMapping.DocumentType) .Select(keyDefinition => keyDefinition.ReferenceDocumentType) .Select(MappingFor)); }); foreach (var function in _systemFunctions.Values.OrderBy(x => x.Name)) { yield return(function); } foreach (var mapping in mappings) { yield return(mapping.SchemaObjects); } yield return(new SequenceFactory(this, _factory, StoreOptions, _logger)); foreach (var transform in StoreOptions.Transforms.AllFunctions().OrderBy(x => x.Name)) { yield return(transform); } if (Events.IsActive) { yield return(Events.SchemaObjects); } }
internal string GetAltGrValue(string key) { return(AllMappings.Where(m => m.Key == key).FirstOrDefault().AltGrValue); }