我有一个类库(让我们称之为)我在其中创建了一个自定义配置文件提供程序。我在另一个类库(我们称之为b)中引用该库,这是一个解决方案的一部分以及一个Web应用程序。现在我如何在类库b中引用自定义配置文件提供程序。
我一直在关注这篇文章http://leedumond.com/blog/getting-strongly-typed-profile-properties-from-a-class-library。哪个好,但它不保存只读它的配置文件。
有没有人这样做或知道怎么做?
答案 0 :(得分:0)
那么这个例子并不是你想要的。
创建继承ProfileBase的ProfileCommon后,使用该类的实例进行管理。
所以:
ProfileCommon profile = (ProfileCommon)HttpContext.Current.Profile;
profile.Name = "balstedfury";
Profile.Save();
由于ProfileCommon继承了ProfileBase,你可以调用它所代表的Save。见http://msdn.microsoft.com/en-us/library/system.web.profile.profilebase_members.aspx
让我知道这有帮助。