forked from ddrilling/AsbCloudServer
Added try/catch for 'Demo data' project for error cases
This commit is contained in:
parent
42b9849ae9
commit
9d80c28c1b
@ -18,6 +18,8 @@ namespace AsbCloudDbDemoData
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||||
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||||
.Options;
|
.Options;
|
||||||
@ -73,15 +75,15 @@ namespace AsbCloudDbDemoData
|
|||||||
);
|
);
|
||||||
|
|
||||||
demoContext.AddRange(
|
demoContext.AddRange(
|
||||||
new RelationCompanyWell{ IdWell = 1, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 1, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 2, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 2, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 3, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 3, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 4, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 4, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 5, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 5, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 6, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 6, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 7, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 7, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 8, IdCompany = 1},
|
new RelationCompanyWell { IdWell = 8, IdCompany = 1 },
|
||||||
new RelationCompanyWell{ IdWell = 9, IdCompany = 1}
|
new RelationCompanyWell { IdWell = 9, IdCompany = 1 }
|
||||||
);
|
);
|
||||||
|
|
||||||
demoContext.WellOperations.AddRange(
|
demoContext.WellOperations.AddRange(
|
||||||
@ -297,5 +299,10 @@ namespace AsbCloudDbDemoData
|
|||||||
else
|
else
|
||||||
Console.WriteLine("Ошибка при добавлении данных");
|
Console.WriteLine("Ошибка при добавлении данных");
|
||||||
}
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user