project reorganized
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Afghanistan",
|
||||
"IsHistorical": false
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Albania",
|
||||
"IsHistorical": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Male"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Female"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Comedy"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Thriller"
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"Name": "Horror"
|
||||
},
|
||||
{
|
||||
"Id": 4,
|
||||
"Name": "Action"
|
||||
},
|
||||
{
|
||||
"Id": 5,
|
||||
"Name": "Drama"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Actor"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Supporting actor"
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"Name": "Voice actor"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"Id": 1,
|
||||
"Name": "Director"
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"Name": "Producer"
|
||||
},
|
||||
{
|
||||
"Id": 3,
|
||||
"Name": "Screenwriter"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace WatchIt.Database.Model.Seeding;
|
||||
|
||||
public class DataReader
|
||||
{
|
||||
#region METHODS
|
||||
|
||||
public static IEnumerable<T> Read<T>() => Read<T>(typeof(T).Name);
|
||||
public static IEnumerable<T> Read<T>(string filename)
|
||||
{
|
||||
string jsonFile = $@"..\..\WatchIt.Database\WatchIt.Database.Model\WatchIt.Database.Model.Seeding\Data\{filename}.json";
|
||||
string dataString = File.ReadAllText(jsonFile);
|
||||
IEnumerable<T>? data = JsonSerializer.Deserialize<IEnumerable<T>>(dataString);
|
||||
if (data is null)
|
||||
{
|
||||
throw new JsonException();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user