279551e9be
modified: Core.Tests/Charter/CurveDataConverterTests.cs modified: Core.Tests/Parsers/CntrlComparisonParserTests.cs modified: Core.Tests/Parsers/LeafInputCsvParserTests.cs modified: Core.Tests/Remote/PiscalSshClientTests.cs modified: Core/Charter/CurveDataConverter.cs modified: Core/Core.csproj modified: Core/DAL/DataService.cs modified: Core/DAL/LeafWebContext.cs modified: Core/DAL/LeafWebInitializer.cs renamed: Core/Models/CntrlComparison.cs -> Core/Entities/CntrlComparison.cs renamed: Core/Models/CntrlComparisonFittingInfo.cs -> Core/Entities/CntrlComparisonFittingInfo.cs renamed: Core/Models/CntrlComparisonPhotosyntheticInfo.cs -> Core/Entities/CntrlComparisonPhotosyntheticInfo.cs renamed: Core/Models/FluxnetSite.cs -> Core/Entities/FluxnetSite.cs renamed: Core/Models/LeafInput.cs -> Core/Entities/LeafInput.cs renamed: Core/Models/LeafInputData.cs -> Core/Entities/LeafInputData.cs renamed: Core/Models/LeafInputFile.cs -> Core/Entities/LeafInputFile.cs renamed: Core/Models/LeafInputInfo.cs -> Core/Entities/LeafInputInfo.cs renamed: Core/Models/LeafInputPhotosynthetic.cs -> Core/Entities/LeafInputPhotosynthetic.cs renamed: Core/Models/LeafInputSite.cs -> Core/Entities/LeafInputSite.cs renamed: Core/Models/LeafInputStatus.cs -> Core/Entities/LeafInputStatus.cs renamed: Core/Models/PhotosynthesisType.cs -> Core/Entities/PhotosynthesisType.cs modified: Core/Parsers/CntrlComparisonParser.cs modified: Core/Parsers/FluxnetSiteCsvParser.cs modified: Core/Parsers/LeafInputCsvParser.cs modified: Web/Controllers/LeafCharterController.cs modified: Web/Controllers/LeafInputController.cs modified: Web/ViewModels/LeafInput/CreateViewModel.cs
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using System.Data.Entity;
|
|
using System.Linq;
|
|
using LeafWeb.Core.Entities;
|
|
using LeafWeb.Core.Parsers;
|
|
using LeafWeb.Core.Utility;
|
|
|
|
namespace LeafWeb.Core.DAL
|
|
{
|
|
public class LeafWebInitializer : DropCreateDatabaseIfModelChanges<LeafWebContext>
|
|
{
|
|
private const string ContentDirectory = @"DAL\InitialData\";
|
|
|
|
protected override void Seed(LeafWebContext context)
|
|
{
|
|
// get fluxnet sites from file
|
|
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "fluxnet_site_list_all_October2015_with_joins_corrected.csv", true);
|
|
var fluxnetSiteCsvParser = new FluxnetSiteCsvParser(fileInfo);
|
|
var fluxnetSites = fluxnetSiteCsvParser.Parse().ToList();
|
|
|
|
// add to context
|
|
fluxnetSites.ForEach(s => context.FluxnetSites.Add(s));
|
|
|
|
var photosynthesisTypes = new []
|
|
{
|
|
new PhotosynthesisType {Id = "C3_photosynthesis_leafweb", Name = "C3 Photosynthesis", SortOrder = 1},
|
|
new PhotosynthesisType {Id = "C4_photosynthesis_leafweb", Name = "C4 Photosynthesis", SortOrder = 2},
|
|
new PhotosynthesisType {Id = "CAM_photosynthesis_leafweb", Name = "CAM Photosynthesis", SortOrder = 3}
|
|
};
|
|
|
|
context.PhotosynthesisTypes.AddRange(photosynthesisTypes);
|
|
|
|
context.SaveChanges();
|
|
|
|
base.Seed(context);
|
|
}
|
|
}
|
|
} |