dnn中个性化服务的使用
1.什么是profiles(个性化服务)
2.dnn模块中的人性化设置:选择此项允许用户自定义模块外观,例如最小化和 最大化。
3.使用中遇到
设置信息
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString, "Voted", True)
获取信息
DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString(), "Voted")
可直接获取用户个性化的信息设置.
Profiles是系统面向用户提供的灵活性的个体信息的容器,一个用户的Profile可以使以下一种或多种的集合:
(1) 简单的字符串或其他基础类型
(2) 一个序列化的实体
(3) 基础类型及序列化实体的Dictionary
保存个性化信息:
1
public static void SaveProfile(BaseForm taskForm)
2
{
3
// Collect profile information
4
if (_profile == null) _profile = new ProfileInfo();
5
_profile.FormColor = taskForm.FormColor;
6
_profile.TextColor = taskForm.TextColor;
7
8
// Save Profile Information
9
IProfileProvider profileProvider;
10
profileProvider = ProfileFactory.GetProfileProvider();
11
profileProvider.SetProfile(Thread.CurrentPrincipal.Identity, _profile);
12
}
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
4
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
5
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
6
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
8
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
加载个性化信息:
1
public static void LoadProfile(BaseForm taskForm)
2
{
3
// Lookup profile information
4
if (_profile == null)
5
{
6
IProfileProvider profileProvider;
7
profileProvider = ProfileFactory.GetProfileProvider();
8
_profile = (ProfileInfo) profileProvider.GetProfile(
9
Thread.CurrentPrincipal.Identity
10
);
11
}
12
13
// Apply profile
14
if (_profile == null) _profile = new ProfileInfo();
15
taskForm.FormColor = _profile.FormColor;
16
taskForm.TextColor = _profile.TextColor;
17
}
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
4
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
5
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
6
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
8
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
12
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
14
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
17
![](https://terrylee.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
2.dnn模块中的人性化设置:选择此项允许用户自定义模块外观,例如最小化和 最大化。
3.使用中遇到
设置信息
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString, "Voted", True)
获取信息
DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString(), "Voted")
可直接获取用户个性化的信息设置.