예제 #1
0
 public MeasureTermsRepository(QuantityDbContext c) : base(c, c?.MeasureTerms)
 {
 }
예제 #2
0
 public UnitsRepository(QuantityDbContext c) : base(c, c.Units)
 {
 }
예제 #3
0
 public MeasuresRepository(QuantityDbContext c) : base(c, c.Measures)
 {
 }
예제 #4
0
 public SystemsOfUnitsRepository(QuantityDbContext c) : base(c, c?.SystemsOfUnits)
 {
 }
예제 #5
0
 private static void AddUnitFactors(List <Core.Units.Data> units, string siSystemId, QuantityDbContext db)
 {
     foreach (var d in from d in units where !(Math.Abs(d.Factor) < double.Epsilon) let o = db.UnitFactors.FirstOrDefaultAsync(
                  m => m.SystemOfUnitsId == siSystemId && m.UnitId == d.Id).GetAwaiter().GetResult() where o is null select d)
     {
         db.UnitFactors.Add(
             new UnitFactorData()
         {
             SystemOfUnitsId = siSystemId,
             UnitId          = d.Id,
             Factor          = d.Factor
         });
     }
 }
예제 #6
0
 public MeasuresRepository(QuantityDbContext c)
 {
     db = c;
 }
예제 #7
0
 private static void Initialize(Core.Units.Data measure, List <Core.Units.Data> units, QuantityDbContext db)
 {
     AddMeasure(measure, db);
     AddTerms(measure, db.MeasureTerms);
     AddUnits(units, measure.Id, db);
     AddTerms(units, db);
     AddUnitFactors(units, SystemOfUnits.SiSystemId, db);
     db.SaveChanges();
 }
예제 #8
0
 private static void AddUnits(IEnumerable <Core.Units.Data> units, string measureId, QuantityDbContext db)
 {
     foreach (var d in from d in units
              let o = GetItem(db.Units, d.Id)
                      where o is null
                      select d)
     {
         db.Units.Add(
             new UnitData
         {
             MeasureId  = measureId,
             Id         = d.Id,
             Code       = d.Code,
             Name       = d.Name,
             Definition = d.Definition
         });
     }
 }
예제 #9
0
 public UnitFactorsRepository(QuantityDbContext c) : base(c, c?.UnitFactors)
 {
 }
예제 #10
0
 public UnitTermsRepository(QuantityDbContext c) : base(c, c?.UnitTerms) { }
예제 #11
0
 public static void Initialize(QuantityDbContext db)
 {
     initializeMeasures(db);
     initializeUnits(db);
 }