Build | Localization.SqlLocalizer | |
---|---|---|
.net core |
========================
Documentation: http://localizationsqllocalizer.readthedocs.io/en/latest/
Basic Usage ASP.NET Core
Add the NuGet package to the project.csproj file
"dependencies": {
"Localization.SqlLocalizer": "3.1.0",
Add the DbContext and use the AddSqlLocalization extension method to add the SQL Localization package.
public void ConfigureServices(IServiceCollection services)
{
// init database for localization
var sqlConnectionString = Configuration["DbStringLocalizer:ConnectionString"];
services.AddDbContext<LocalizationModelContext>(options =>
options.UseSqlite(
sqlConnectionString,
b => b.MigrationsAssembly("ImportExportLocalization")
),
ServiceLifetime.Singleton,
ServiceLifetime.Singleton
);
// Requires that LocalizationModelContext is defined
services.AddSqlLocalization(options => options.UseTypeFullNames = true);
Create your database
dotnet ef migrations add Localization --context localizationModelContext
dotnet ef database update Localization --context localizationModelContext
========================