ASPNETDB 表和视图(3) 个性化用户配置、页面个性化设置 表 和视图

个性化用户配置(用户自定义属性)表


由此表结构可以看出,所有的用户自定义属性最后都是“打包”(序列化)成一个或两个数据块,
存放在PropertyValuesString(序列化为string、Xml) 和(或) PropertyValuesBinary(序列化为Binary)
两个(或其中之一)字段中,因此要求用户自定义属性必须支持序列化。

序列化方式可由web.config中的serializeAs指定,SqlProfileProvider默认序列化方式为String。

例如用户在web.config中配置了如下自定义属性,这里的serializeAs="String" 仅仅为了表示
可以用户可以自行指定序列化方式,谢不写是一个样的:

<system.web>
  ...
  <connectionStrings>
    <add connectionString="..."/>
  </connectionStrings>
  ...
  <profile defaultProvider="SqlSrvProfileProvider">
     <providers>
       ...
         </providers>
    <properties>
         <add type="System.String"  serializeAs="String" />
         <group >
             <add type="System.String"  serializeAs="String" />
             <add type="System.String" serializeAs="String"  />
            <add type="System.DateTime" serializeAs="String" />
         </group>
      </properties>
  </profile>
  ...
</system.web> 

并运行了aspx页面中的以下C#代码:

this.Profile.ThemeName = "Blue";
this.Profile.PersonalInfo.FirstName = "John";
this.Profile.PersonalInfo.LastName = "Smith";
this.Profile.PersonalInfo.Birthday = new DateTime(1970, 11, 22);

然后打开数据库中的aspnet_Profile查看表,两个字段的内容分别为:
PropertyNames:        "PersonalInfo.FirstName:S:0:4:PersonalInfo.Birthday:S:4:81:PersonalInfo.LastName:S:85:5:ThemeName:S:90:4:"
PropertyValuesString:"John 1970-11-22T00:00:00SmithBlue"

注:以后在实现自定义用户配置提供程序(ProfileProvider) 一文中我会更详尽地讨论。


有关页面个性化设置的3个表

关系图


页面路径(地址)表


处于共享范围(Shared Scope)的页面个性化设置表


处於单用户范围(User Scope)的页面个性化设置表



视图
  1. aspnet_Applications表的全表视图。

    vw_aspnet_Applications
  2. aspnet_Membership表与aspnet_Users表的关联视图

    vw_aspnet_MembershipUsers
  3. 返回aspnet_Profiles表的用户ID、上次修改时间
    和属性名称串、字符串属性值、二进制属性值的总长度

    vw_aspnet_Profiles
  4. aspnet_Roles表的全表视图。

    vw_aspnet_Roles
  5. aspnet_Users表的全表视图。

    vw_aspnet_Users
  6. aspnet_UsersInRoles表的全表视图。

    vw_aspnet_UsersInRoles
  7. aspnet_Paths表的全表视图。

    vw_aspnet_WebPartState_Paths
  8. 返回aspnet_PersonalizationAllUsers表的页面路径ID、
    以二进制形式保存的页面配置属性的长度和上次修改时间。

    vw_aspnet_WebPartState_Shared
  9. 返回aspnet_WebPartState_User表的页面路径ID、用户ID、
    以二进制形式保存的页面配置属性的长度和上次修改时间。

    vw_aspnet_WebPartState_User
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章