public SpanishInflectorTest()
        {
            SingularToPlural.Add("inglés", "ingleses");
            SingularToPlural.Add("hijo", "hijos");
            SingularToPlural.Add("paz", "paces");
            SingularToPlural.Add("crisis", "crisis");
            SingularToPlural.Add("praxis", "praxis");
            SingularToPlural.Add("apendicitis", "apendicitis");
            SingularToPlural.Add("llave", "llaves");
            SingularToPlural.Add("auto", "autos");
            SingularToPlural.Add("ordén", "ordenes");
            SingularToPlural.Add("item", "items");
            SingularToPlural.Add("linea", "lineas");
            SingularToPlural.Add("proveedor", "proveedores");
            SingularToPlural.Add("Terminal", "Terminales");
            SingularToPlural.Add("ParteFichaTecnica", "ParteFichaTecnicas");
            SingularToPlural.Add("pago", "pagos");
            SingularToPlural.Add("Ubicación", "Ubicaciones");
            SingularToPlural.Add("Origén", "Origenes");
            SingularToPlural.Add("ciudad", "ciudades");
            SingularToPlural.Add("documento", "documentos");
            SingularToPlural.Add("Historial", "Historiales");
            SingularToPlural.Add("Promoción", "Promociones");

            SingularToPlural.Add("Ordén", "Ordenes");
            SingularToPlural.Add("Cliente", "Clientes");
            SingularToPlural.Add("Proveedor", "Proveedores");
            SingularToPlural.Add("Factura", "Facturas");

            SingularToPlural.Add("Tarifa", "Tarifas");
            SingularToPlural.Add("Telefono", "Telefonos");
            SingularToPlural.Add("TelefonoTipo", "TelefonoTipos");
            SingularToPlural.Add("Territorio", "Territorios");
            SingularToPlural.Add("Titulo", "Titulos");
            SingularToPlural.Add("Tratamiento", "Tratamientos");
            SingularToPlural.Add("Usuario", "Usuarios");
            SingularToPlural.Add("Rol", "Roles");
            SingularToPlural.Add("Item", "Items");

            TestInflector = new SpanishInflector();
        }
 public void PluralizeUnaccentWords()
 {
     var inflector = new SpanishInflector();
     inflector.Pluralize("Orden").Should().Be("Ordenes");
 }
Exemplo n.º 3
0
        private Mapper GetMapper()
        {
            #region Initialize ConfORM
            var inflector = new SpanishInflector();

            var orm = new ObjectRelationalMapper();

            IPatternsAppliersHolder patternsAppliers =
                (new SafePropertyAccessorPack())
                    .Merge(new SafePoidPack())
                    .Merge(new OneToOneRelationPack(orm))
                    .Merge(new BidirectionalManyToManyRelationPack(orm))
                    .Merge(new BidirectionalOneToManyRelationPack(orm))
                    .Merge(new DiscriminatorValueAsClassNamePack(orm))
                    .Merge(new PluralizedTablesPack(orm, inflector))
                    .Merge(new CoolColumnsNamingPack(orm))
                    .UnionWith(new ConfOrm.Shop.InflectorNaming.CollectionOfElementsColumnApplier(orm, inflector))
                    .Merge(new PolymorphismPack(orm))
                    .Merge(new TablePerClassPack())
                    .Merge(new UseNoLazyForNoProxablePack()) // <== Lazy false when the class is not proxable
                    .Merge(new UnidirectionalOneToManyMultipleCollectionsKeyColumnApplier(orm))
                    .Merge(new UseCurrencyForDecimalApplier());

            // orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(new {max_lo = 100}));

            var mapper = new Mapper(orm, patternsAppliers);

            IEnumerable<Type> tablePerClassEntities =
                typeof(Entity).Assembly.GetTypes().Where(
                    t => IsRootEntity(t) && !_tablePerClassHierarchy.Contains(t) && !_tablePerConcreteClass.Contains(t)).ToList();

            // Mappings
            orm.TablePerClass(tablePerClassEntities);
            orm.TablePerClassHierarchy(_tablePerClassHierarchy);
            orm.TablePerConcreteClass(_tablePerConcreteClass);
            #endregion

            ConfOrmMapping(orm, mapper);

            return mapper;
        }