Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Asp.net core 實務實戰教學

507 views

Published on

2017 Study4TW .Net Conf ppt
lab: http://dog0416.blogspot.tw/2017/10/2017-study4tw-net-conf-aspnet-core.html
github :https://github.com/matsurigoto/AspDotNetCoreExample

Published in: Education
  • Be the first to comment

Asp.net core 實務實戰教學

  1. 1. .NET Conf Learn. Imagine. Build. .NET Conf ASP.NET Core 實務實戰教學 網頁開發範例與 windows 服務 Duran Hsieh
  2. 2. .NET Conf
  3. 3. .NET Conf
  4. 4. .NET Conf
  5. 5. .NET Conf NET Core – Microsoft
  6. 6. .NET Conf
  7. 7. .NET Conf
  8. 8. .NET Conf
  9. 9. .NET Conf
  10. 10. .NET Conf { "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Warning" } }, "EmailConfig" { "SMTP": "test.smtp.com", "Port": 25 } } <appSettings> <add key="SMTP" value="smtp.test.com" /> <add key="Port" value="25" /> </appSettings>
  11. 11. .NET Conf WebConfigurationManager 到 注入轉換成DTO使用 過去:System.Web.Configuration.WebConfigurationManager.AppSettings[“XXXSetting"];
  12. 12. .NET Conf 現在:1.建立 DTO 物件 private EmailConfig _emailConfig = null; public HomeController(IOptions<EmailConfig> emailConfig) { _emailConfig = emailConfig.Value; } public class EmailConfig { public string SMTP { get; set; } public int Port { get; set; } } 2. Startup.cs 的ConfigureServices 方法內註冊 public void ConfigureServices(IServiceCollection services) { services.Configure<EmailConfig>(Configuration.GetSection("EmailConfig")); } 3.建構子注入使用
  13. 13. .NET Conf 路由設定
  14. 14. .NET Conf
  15. 15. .NET Conf
  16. 16. .NET Conf
  17. 17. .NET Conf
  18. 18. .NET Conf
  19. 19. .NET Conf
  20. 20. .NET Conf
  21. 21. .NET Conf
  22. 22. .NET Conf
  23. 23. .NET Conf
  24. 24. .NET Conf
  25. 25. .NET Conf
  26. 26. .NET Conf fb.com/Study4.twfb.com/groups/216312591822635 Study4.TW
  27. 27. .NET Conf

×