Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ProductsController : Controller
- {
- private readonly MyDbContext _context;
- public ProductsController(MyDbContext context)
- {
- _context = context;
- }
- [HttpGet]
- public string Get()
- {
- var productName = _context.Products
- .Single(x => x.Id == 1)
- .Name;
- return productName; = // "PÃO FRANCÊS"
- }
- }
- private static void Main(string[] args)
- {
- // setup DI
- Initialize();
- var context = ServiceProvider.GetService<MyDbContext>();
- var productName = context.Products
- .Single(x => x.Id == 1)
- .Name;
- Console.WriteLine(productName); // "P�O FRANC�S"
- }
- Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- Console.OutputEncoding = System.Text.Encoding.Unicode;
Add Comment
Please, Sign In to add comment