public DbLocalizedStringSource GetLocalizedStrings(Type resourceSource)
        {
            using IDbConnection con = new NpgsqlConnection(connectionString);
            con.Open();
            using IDbTransaction tran = con.BeginTransaction();


            string sql = @"
SELECT
   key_name as Key
  ,ja       as Ja
  ,en       as En
FROM
   localization_resource
WHERE
   category = @category
ORDER BY
  key
";

            var param = new
            {
                category = resourceSource.Name
            };

            IEnumerable <LocalizationRecord> records = con.Query <LocalizationRecord>(sql, param, tran);

            return(DbLocalizedStringSource.FromEnumerable(records));
        }
Exemplo n.º 2
0
        private DbStringLocalizer CreateDbStringLocalizer(Type resourceSource)
        {
            DbLocalizedStringSource source = _dbLocalizedStringSourceProvider.GetLocalizedStrings(resourceSource);

            return(new DbStringLocalizer(source));
        }
Exemplo n.º 3
0
 public DbStringLocalizer(DbLocalizedStringSource dbLocalizedStringSource)
 {
     _dbLocalizedStringSource = dbLocalizedStringSource;
 }