public RelatedUnit WithPrefixedUnit(string unitShortName, string fieldName,
                                            decimal multiplicator, string fromMethodNameSufix = null, TypeCodeAliases aliases = null,
                                            Action <AliasedPrefixedUnitInfo> extraSettings    = null)
        {
            if (aliases != null)
            {
                if (string.IsNullOrWhiteSpace(fieldName))
                {
                    if (!string.IsNullOrWhiteSpace(aliases.NameSingular))
                    {
                        fieldName = aliases.NameSingular.FirstUpper();
                    }
                }
                if (string.IsNullOrWhiteSpace(fromMethodNameSufix))
                {
                    if (!string.IsNullOrWhiteSpace(aliases.NamePlural))
                    {
                        fromMethodNameSufix = aliases.NamePlural.FirstUpper();
                    }
                }
            }

            AliasedPrefixedUnitInfo info = new AliasedPrefixedUnitInfo(fieldName,
                                                                       UnitShortCodeSource.MakeDirect(unitShortName), multiplicator.CsEncode(),
                                                                       fromMethodNameSufix, aliases);

            if (extraSettings != null)
            {
                extraSettings(info);
            }
            Units.Add(info);
            return(this);
        }
        private RelatedUnit WithPowerDerivedUnits(int power, PrefixedUnitInfo[] items, XValueTypeName[] values)
        {
            Power = power;
            if (power != 1)
            {
                PowerOne = new TypesGroup(values[0]);
            }

            var propertyPrefix = Prefix(power);

            foreach (var i in items)
            {
                var fromMethodNameSufix = i.FromMethodNameSufix.AddPrefix(propertyPrefix);
                var unitShortCodeSource = UnitShortCodeSource.MakePower(i.UnitShortCode, power);
                var q = new AliasedPrefixedUnitInfo(propertyPrefix + i.FieldName,
                                                    unitShortCodeSource,
                                                    Mul(power, i.ScaleFactor), fromMethodNameSufix, null);
                Units.Add(q);
            }

            if (power <= 1)
            {
                return(this);
            }
            for (var i = 1; i < power; i++)
            {
                var otherUnitContainer = values[i - 1] + "Unit";
                var myUnitContainer    = values[power - 1] + "Unit";
                var relation           = new UnitNamePrefixRelation(
                    Prefix(i), Prefix(power),
                    myUnitContainer, otherUnitContainer);
                PrefixRelations.Add(relation);
            }

            return(this);
        }