示例#1
0
        protected override void Add_FromMethods()
        {
            var collection  = CommonFractionalUnitDefs.All;
            var commonUnits = collection.GetBy(Cfg.UnitTypes.Unit);

            if (commonUnits.Length == 0)
            {
                return;
            }
            foreach (var i in commonUnits)
            {
                var u = new RelatedUnitInfo(i.TargetPropertyName,
                                            UnitShortCodeSource.MakeDirect(i.GetUnitName()),
                                            i.TargetPropertyName);
                BasicUnitValuesGenerator.Add_FromMethods(
                    GetType(),
                    i.Type.Value,
                    i.Type,
                    Target,
                    u);
            }
        }
示例#2
0
        private void Add_FromMethods()
        {
            var tmp = RelatedUnitGeneratorDefs.All;
            var d   = tmp.ByName(Cfg.UnitTypes.Value);

            if (d is null)
            {
                IRelatedUnitDefinition u = new RelatedUnitInfo(
                    Cfg.BaseUnit.Field,
                    UnitShortCodeSource.MakeDirect("----"),
                    Cfg.BaseUnit.Field);
                Add_FromMethods(GetType(), Cfg.UnitTypes.Value, Cfg.UnitTypes, Target, u);
                return;
            }

            if (d.Units is null || d.Units.Count == 0)
            {
                return;
            }
            foreach (var u in d.Units)
            {
                Add_FromMethods(GetType(), Cfg.UnitTypes.Value, Cfg.UnitTypes, Target, u);
            }
        }