/// <summary> /// Constructor that creates a model from all NHibernate mappings and embedded enumeration information /// in the set of installed plugins. /// </summary> /// <param name="config"></param> /// <param name="namespaceFilter"></param> public RelationalModelInfo(Configuration config, RelationalSchemaOptions.NamespaceFilterOption namespaceFilter) { _tables = CollectionUtils.Map(GetTables(config, namespaceFilter), (Table table) => BuildTableInfo(table, config)); _enumerations = CollectionUtils.Select( new EnumMetadataReader().GetEnums(config), enumeration => namespaceFilter.Matches(enumeration.EnumerationClass)); }
public RelationalSchemaGenerator(RelationalSchemaOptions options) { _options = options; }
/// <summary> /// Gets the set of NHibernate <see cref="Table"/> objects known to the specified configuration. /// </summary> /// <param name="cfg"></param> /// <param name="namespaceFilter"></param> /// <returns></returns> private static List<Table> GetTables(Configuration cfg, RelationalSchemaOptions.NamespaceFilterOption namespaceFilter) { // build set of all tables var tables = new HybridSet(); var filteredClassMappings = CollectionUtils.Select( cfg.ClassMappings, classMapping => namespaceFilter.Matches(classMapping.MappedClass.Namespace)); foreach (var pc in filteredClassMappings) { foreach (var table in pc.TableClosureIterator) { tables.Add(table); } } var filteredCollectionMappings = CollectionUtils.Select( cfg.CollectionMappings, collectionMapping => namespaceFilter.Matches(collectionMapping.Owner.MappedClass.Namespace)); foreach (var collection in filteredCollectionMappings) { tables.Add(collection.CollectionTable); } return CollectionUtils.Sort(tables, (Table x, Table y) => x.Name.CompareTo(y.Name)); }
/// <summary> /// Constructor that creates a model from all NHibernate mappings and embedded enumeration information /// in the set of installed plugins. /// </summary> public RelationalModelInfo(PersistentStore store, RelationalSchemaOptions.NamespaceFilterOption namespaceFilter) : this(store.Configuration, namespaceFilter) { }
public RelationalSchemaGenerator(RelationalSchemaOptions options) { _options = options; }