public static async Task <WaterSourcesDim> Load(WaDEContext db, WaterSourcesDimBuilderOptions opts)
        {
            opts.WaterSourceType = opts.WaterSourceType ?? await WaterSourceTypeBuilder.Load(db);

            opts.WaterQualityIndicator = opts.WaterQualityIndicator ?? await WaterQualityIndicatorBuilder.Load(db);

            var item = Create(opts);

            db.WaterSourcesDim.Add(item);
            await db.SaveChangesAsync();

            return(item);
        }
示例#2
0
        public static async Task <RegulatoryOverlayDim> Load(WaDEContext db, RegulatoryOverlayDimBuilderOptions opts)
        {
            opts = opts ?? new RegulatoryOverlayDimBuilderOptions();

            opts.RegulatoryStatus = opts.RegulatoryStatus ?? await RegulatoryStatusBuilder.Load(db);

            opts.RegulatoryOverlayType = opts.RegulatoryOverlayType ?? await RegulatoryOverlayTypeBuilder.Load(db);

            opts.WaterSourceType = opts.WaterSourceType ?? await WaterSourceTypeBuilder.Load(db);

            var item = Create(opts);

            db.RegulatoryOverlayDim.Add(item);
            await db.SaveChangesAsync();

            return(item);
        }
 public static WaterSourcesDim Create(WaterSourcesDimBuilderOptions opts)
 {
     return(new Faker <WaterSourcesDim>()
            .RuleFor(a => a.WaterSourceUuid, f => f.Random.Uuid().ToString())
            .RuleFor(a => a.WaterSourceNativeId, f => f.Random.Uuid().ToString())
            .RuleFor(a => a.WaterSourceName, f => f.Random.Word())
            .RuleFor(a => a.WaterSourceTypeCv, f => opts.WaterSourceType?.Name ?? WaterSourceTypeBuilder.GenerateName())
            .RuleFor(a => a.WaterQualityIndicatorCv, f => opts.WaterQualityIndicator?.Name ?? WaterQualityIndicatorBuilder.GenerateName())
            .RuleFor(a => a.GnisfeatureNameCv, f => opts.GnisfeatureName?.Name));
 }