-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,287 additions
and
3,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Expressio.Models; | ||
|
||
public class ExpressioContext : DbContext | ||
{ | ||
public ExpressioContext(DbContextOptions<ExpressioContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
public ExpressioContext() | ||
: base() | ||
{ | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.Entity<Language>() | ||
.HasMany(e => e.Expressions) | ||
.WithOne(e => e.Language) | ||
.HasForeignKey("LanguageId") | ||
.IsRequired(); | ||
modelBuilder.Entity<Language>().HasData( | ||
new Language(){ Id = 1, Code = "fr" } | ||
); | ||
modelBuilder.Entity<Expression>().HasData( | ||
new FileLoader("Resources/expressions_fr.json").Load().Skip(3000) | ||
); | ||
} | ||
|
||
public virtual DbSet<Language> Languages { get; set; } | ||
public virtual DbSet<Expression> Expressions { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class ExpressionDTO | ||
{ | ||
public long Id { get; set; } | ||
public required string Content { get; set; } | ||
public List<string>? Definitions { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Expressio.Controllers; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Expressio.Models; | ||
|
||
public class Language | ||
{ | ||
public long Id { get; set; } | ||
public required string Code { get; set; } | ||
public virtual ICollection<Expression> Expressions { get; set; } | ||
Check warning on line 10 in src/Expressio/Models/Language.cs
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.