Sitecore 自定义用户配置文件 - 它存储在哪里,如何查询
我在 Sitecore 的核心数据库中创建了一个自定义用户配置文件模板和对象(根据 Security API Cookbook)。
我可以通过编程方式选择此选项(根据安全 API 手册),以便我的外联网用户拥有扩展的配置文件,涵盖所有常见的可疑内容(地址、电话、电子邮件格式等)。
但是,这些数据存储在哪里?如果我想查询数据库以根据此配置文件数据返回用户子集,我该如何访问它。
Extranet 会员系统的典型要求是提取用户列表以通过电子邮件或电话类型的活动进行联系。这可以通过 Sitecore 会员系统来完成吗?
更新> 我将猜测并说配置文件数据存储在 aspnet_Profile.PropertyValuesBinary 中..这将使其几乎无法查询并且不适合我的目的。那是不幸的。因此,为了扩展我的问题,如果是这种情况,是否可以让 Sitecore 将这些值存储在文本字段中,以便可以搜索它们?
I have created a custom User profile template and object in the core database in Sitecore (as per the Security API Cookbook).
I can select this programmatically (as per the Security API Cookbook) so that my extranet users have an extended profile, that covers all the usual suspects (Address, phone, email format etc.)
However, where is this data stored? And how do I access it if I want to query the database to return a subset of users based on this profile data.
A typical requirement for an extranet member system is to extract a list of users to contact either in an email or a phone type campaign. Can this be done with the Sitecore membership system?
UPDATE>
I'm going to take a guess and say the profile data is stored in aspnet_Profile.PropertyValuesBinary .. which would make it nigh on impossible to query and not suited to my purpose. That is unfortunate. So to extend my question, if that is the case, is it possible to get Sitecore to store those values in the text field so they are searchable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SqlProfileProvider 的标准 Microsoft 实现(默认在 Sitecore 中使用)将用户配置文件信息存储在 aspnet_Profile 表中。所有属性都序列化到 PropertyNames / PropertyValuesString 列中。 PropertyValuesBinary 用于存储二进制数据(图像)。如果您查看System.Web.Profile.SqlProfileProvider、SetPropertyValues方法的代码,您可以找到更多详细信息。
接下来,您在用户配置文件中定义的所有自定义属性都将序列化为 Profile 类的 SerializedData 属性,并像任何其他属性一样再次序列化为 PropertyNames / PropertyValuesString 列。
此外,几个属性存储在 aspnet_Membership 表中(出于某种原因) - 电子邮件和评论。
因此,如果您要通过电子邮件查询用户,可以使用 MembershipProvider 的 FindUsersByEmail 方法。否则,如果您计划按另一个属性值进行过滤,我想您将必须获取所有用户并过滤获得的集合。
希望这有帮助。
The standard Microsoft implementation of the SqlProfileProvider (which is used in Sitecore by default) stores the user profile information in the aspnet_Profile table. All the properties are serialized into the PropertyNames / PropertyValuesString columns. The PropertyValuesBinary is used to store the binary data (images). You can find more details if you look at the code of System.Web.Profile.SqlProfileProvider, SetPropertyValues method.
Next, all the custom properties you define in the user profile, are serialized to the SerializedData property of the Profile class, and it is again serialized to the PropertyNames / PropertyValuesString columns like any other property.
Also, couple of properties are stored in aspnet_Membership table (for some reason) - Email and Comment.
So, if you are going to query the users by Email, you can use FindUsersByEmail method of MembershipProvider. Otherwise, if you plan to filter by another property value, I suppose, you'll have to get all users and filter the obtained collection.
Hope this helps.
我上周遇到了这个确切的问题,没有想出永久的解决方案,但为了解决我的特定问题,我编写了一个小帮助页面,并将其添加为可从 CMS 界面访问的 Sitecore 应用程序。它所做的只是查询所有用户,并确定他们是否分配了 5-6 个配置文件属性。
这是获取用户的相关行,它返回 Sitecore.Common.IFilterable
因此,如果您需要做一些从所有用户获取个人资料信息的事情,您可以这样做:
这对于我的目的来说非常有效,但我不知道在你的情况下它的可行性如何。
I faced this exact problem last week, didn't come up with a permanent solution, but to solve my particular issue, I wrote a little helper page and added it as a Sitecore application to be accessed from the CMS interface. All it did was query all users, and determine if they had any of like 5-6 profile properties assigned.
That is the relevant line to grab the users, it returns Sitecore.Common.IFilterable
So if you need to do something where you're grabbing profile info from all users, you cn do something like this:
This worked out very well for my purposes, but I don't know how feasible it will be in your situation.