🗃️ automatically add data to db when running backend
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
		
							parent
							
								
									3392bb55b2
								
							
						
					
					
						commit
						0fdc0e6af5
					
				
					 3 changed files with 40 additions and 1 deletions
				
			
		|  | @ -1,10 +1,12 @@ | |||
| #nullable disable | ||||
| 
 | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using CsvHelper.Configuration; | ||||
| using System.Globalization; | ||||
| 
 | ||||
| namespace backend; | ||||
| 
 | ||||
| [PrimaryKey(nameof(Id))] | ||||
| // [PrimaryKey(nameof(Id))] | ||||
| public class MovieDB | ||||
| { | ||||
|     public int Id { get; set; } | ||||
|  | @ -18,4 +20,14 @@ public class MovieDB | |||
|     public string Type { get; set; } | ||||
| 
 | ||||
|     public string Poster { get; set; } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| public class MovieDBMap : ClassMap<MovieDB> | ||||
| { | ||||
|     public MovieDBMap() | ||||
|     { | ||||
|         AutoMap(CultureInfo.InvariantCulture); | ||||
|         Map(m => m.Id).Ignore(); | ||||
|     } | ||||
| } | ||||
		Reference in a new issue
	
	 haraldnilsen
						haraldnilsen