组合通过 webservices 配置文件服务 aspnet 提供的属性

发布于 2024-08-04 06:33:42 字数 1279 浏览 3 评论 0 原文

我真的不确定我的问题的标题是什么,如果有点含糊的话,很抱歉。

我正在开发一个使用客户端应用程序服务进行身份验证/配置文件管理等的应用程序。

在我网站的 web.config 中,我有以下配置文件属性,如下所示:

<properties>
  <add name="FirstName" type="string" defaultValue="" customProviderData="FirstName;nvarchar"/>
...

基本的内容,如名字、姓氏等。

我正在公开我的客户端应用程序的属性如下:

<system.web.extensions>
    <scripting>
        <webServices>
            <authenticationService enabled="true" requireSSL="false"/>
            <profileService enabled="true" readAccessProperties="UserProfile" writeAccessProperties="UserProfile"/>
            <roleService enabled="true"/>
        </webServices>
    </scripting>
</system.web.extensions>

我想知道是否可以将所有单独的配置文件属性捆绑到一个对象中以供客户端应用程序使用?我最初将所有配置文件数据存储为单个类 (UserProfile) 的成员,但我将其全部分解,以便我可以使用 SqlTableProfileProvider 将每个字段存储为相关表中的单独列。

我知道我可以为每种类型创建一个包含成员的类,我只是不确定是否有一种简单的方法来创建一个包含所有属性值的对象(除了每当我分配给独立属性时都为该对象分配值) 。

我认为我没有很好地解释这一点,所以我会尝试举一个例子。

假设在我的网站配置文件中我有 FirstName 和 LastName 作为属性。

对于我的客户端应用程序 profileService,我想要一个 ReadAccessProperty FullName。

是否有某种方法可以从现有的 FirstName 和 LastName 属性自动创建 FullName,而不必拥有单独的 FullName 属性(并且每当我将数据分配给 FirstName 和 LastName 时手动为其分配数据)?

I really wasn't sure what the title for my question could be, so sorry if it's a bit vague.

I'm working on an application that uses client application services for authentication/profile management etc.

In web.config for my website, I have the following profile properties like this:

<properties>
  <add name="FirstName" type="string" defaultValue="" customProviderData="FirstName;nvarchar"/>
...

Basic things like first name, last name etc.

I'm exposing properties for my client app like this:

<system.web.extensions>
    <scripting>
        <webServices>
            <authenticationService enabled="true" requireSSL="false"/>
            <profileService enabled="true" readAccessProperties="UserProfile" writeAccessProperties="UserProfile"/>
            <roleService enabled="true"/>
        </webServices>
    </scripting>
</system.web.extensions>

What I'm wondering is whether it's possible to bundle all the individual profile properties into a single object for client apps to utilize? I originally had all my profile data stored as members of a single class (UserProfile) but I broke it all out so that I could use the SqlTableProfileProvider to store each field as individual columns in relevant tables.

I know I can create an class with members for each type, I'm just not sure if there's an easy way to create an object with all my property values (other than assigning values to this object whenever I assign to the the standalone properties).

I don't think I'm explaining this very well, so I'll try an example.

Say in my website profile I have FirstName and LastName as properties.

For my client application profileService I want to have one ReadAccessProperty FullName.

Is there some way to automatically create FullName from the existing FirstName and LastName properties without having to also have a seperate FullName property (and manually assign data to it whenever I assign data to FirstName and LastName)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾其所爱 2024-08-11 06:33:42

并非没有对应用程序服务层进行大量重新安装。

执行此操作的最简单方法是使用从服务返回的数据重新构建之前废弃的配置文件类。

Not without a lot of replumbing of the ApplicationServices layer.

The easiest way for you to do this is to simply reconstitute your previously obsoleted profile class with the data returned from the service.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文