ASP.Net 5 RC2 configuration section binding

眉间皱痕 提交于 2019-12-10 12:33:00

问题


I have just upgraded my sample app from RC1 to RC2 and I can't find how to bind a specific section of my appSettings.json file to my own POCO anymore.

The sample at https://github.com/aspnet/live.asp.net/blob/rc2/src/live.asp.net/Startup.cs#L47 show that something like this should work:

services.Configure<AppSettings>(options => Configuration.GetSection("AppSettings").Bind(options));

But with the final RC2 bits the "Bind" method or extension method can't be found

Any idea where it lives now or if there is a new approach for this?


回答1:


Ok, found it. It turns out the binder has moved to another package: Microsoft.Extensions.Configuration.Binder

Once I added this package the code in the original question works unchanged



来源:https://stackoverflow.com/questions/37289751/asp-net-5-rc2-configuration-section-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!