-
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.
add language and update LanguageResource
- Loading branch information
1 parent
2102ab1
commit 53ba7d5
Showing
9 changed files
with
373 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Unitagram.Domain.Common; | ||
|
||
namespace Unitagram.Domain; | ||
|
||
public class Language : BaseEntity | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = string.Empty; | ||
public string Culture { get; set; } = string.Empty; | ||
|
||
public ICollection<LanguageResource>? LanguageResources { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
using Unitagram.Domain; | ||
using Unitagram.Domain.Common; | ||
using Unitagram.Domain.Primitives; | ||
|
||
namespace Unitagram.Domain; | ||
|
||
public class LanguageResource : BaseEntity, IAuditableEntity | ||
{ | ||
public int Id { get; set; } | ||
public string Language { get; set; } = string.Empty; | ||
public int LanguageId { get; set; } | ||
public string Source { get; set; } = string.Empty; | ||
public string SourceKey { get; set; } = string.Empty; | ||
public string Value { get; set; } = string.Empty; | ||
public string? ModifiedBy { get; set; } | ||
public string? CreatedBy { get; set; } | ||
public DateTime CreatedOnUtc { get; set; } | ||
public DateTime? ModifiedOnUtc { get; set; } | ||
|
||
public Language Language { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,7 @@ | |
</ItemGroup> | ||
|
||
|
||
<ItemGroup> | ||
<Folder Include="LocalizationCache\" /> | ||
</ItemGroup> | ||
|
||
|
||
|
||
</Project> |
19 changes: 19 additions & 0 deletions
19
Unitagram.Persistence/Configurations/LanguageConfiguration.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Unitagram.Domain; | ||
|
||
namespace Unitagram.Persistence.Configurations; | ||
|
||
public class LanguageConfiguration : IEntityTypeConfiguration<Language> | ||
{ | ||
public void Configure(EntityTypeBuilder<Language> builder) | ||
{ | ||
builder.HasKey(u => u.Id); | ||
|
||
builder.Property(u => u.Culture) | ||
.HasMaxLength(5); | ||
|
||
builder.Property(u => u.Name) | ||
.HasMaxLength(30); | ||
} | ||
} |
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
186 changes: 186 additions & 0 deletions
186
Unitagram.Persistence/Migrations/20230919210336_UpdateLanguageResource.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
97 changes: 97 additions & 0 deletions
97
Unitagram.Persistence/Migrations/20230919210336_UpdateLanguageResource.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Unitagram.Persistence.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class UpdateLanguageResource : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropPrimaryKey( | ||
name: "PK_LanguageResource", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "Language", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.AddColumn<int>( | ||
name: "LanguageId", | ||
table: "LanguageResource", | ||
type: "int", | ||
nullable: false, | ||
defaultValue: 0); | ||
|
||
migrationBuilder.AddPrimaryKey( | ||
name: "PK_LanguageResource", | ||
table: "LanguageResource", | ||
columns: new[] { "Id", "Source", "SourceKey" }); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Language", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(type: "int", nullable: false) | ||
.Annotation("SqlServer:Identity", "1, 1"), | ||
Name = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false), | ||
Culture = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Language", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_LanguageResource_LanguageId", | ||
table: "LanguageResource", | ||
column: "LanguageId"); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "FK_LanguageResource_Language_LanguageId", | ||
table: "LanguageResource", | ||
column: "LanguageId", | ||
principalTable: "Language", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "FK_LanguageResource_Language_LanguageId", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Language"); | ||
|
||
migrationBuilder.DropPrimaryKey( | ||
name: "PK_LanguageResource", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_LanguageResource_LanguageId", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "LanguageId", | ||
table: "LanguageResource"); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "Language", | ||
table: "LanguageResource", | ||
type: "nvarchar(5)", | ||
maxLength: 5, | ||
nullable: false, | ||
defaultValue: ""); | ||
|
||
migrationBuilder.AddPrimaryKey( | ||
name: "PK_LanguageResource", | ||
table: "LanguageResource", | ||
columns: new[] { "Id", "Language", "Source", "SourceKey" }); | ||
} | ||
} | ||
} |
Oops, something went wrong.