forked from liaozb/APIJSON.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableMapper.cs
More file actions
26 lines (25 loc) · 762 Bytes
/
TableMapper.cs
File metadata and controls
26 lines (25 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
namespace APIJSON.NET.Services
{
public class TableMapper : ITableMapper
{
private readonly Dictionary<string, string> _options= new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
public TableMapper(IOptions<Dictionary<string, string>> options)
{
foreach (var item in options.Value)
{
_options.Add(item.Key, item.Value);
}
}
public string GetTableName(string oldname)
{
if (_options.ContainsKey(oldname))
{
return _options.GetValueOrDefault(oldname);
}
return oldname;
}
}
}