ASP.NET 中的 Provider 是什么意思?

发布于 2024-08-26 07:58:18 字数 120 浏览 5 评论 0原文


我很困惑。我们经常听说 ASP.NET 中的 Provider。成员资格提供程序、角色提供程序、XmlDataProvider、自定义提供程序、...
这些是什么以及为什么我们在 ASP.NET 中需要它们?



I've got confused . We hear a lot about Provider in ASP.NET . Membership-Provider , Role Provider , XmlDataProvider ,CustomProvider, ....

What are those and why we need them in ASP.NET ?

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

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

发布评论

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

评论(2

情深缘浅 2024-09-02 07:58:18

Provider 是“供应商”的同义词,意思是:

某人的业务是提供
特定服务或商品

就像在现实生活中一样,提供商是帮助您解决与特定服务的通信或帮助您解决问题的人/事物。

例如,.NET 中的会员资格提供程序用于处理会员资格,例如身份验证、注册新用户以及随之而来的更多选项。

角色提供程序与上述内容密切相关,因为它可以帮助您处理附加到您所拥有的用户的角色(他们有成员资格!)。

您可能想阅读以下内容:来自 MSDN 的 Microsoft ASP.NET 2.0 提供程序简介

Provider is a synonyme with "Supplier" which means:

Someone whose business is to supply a
particular service or commodity

Just as in real life, a provider is someone / something that helps you solve communicaiton with a certain service or help you solve a problem.

For instance, the Membership Provider in .NET is used to handle Membership such as Authentication, Registering new Users and many more options comes with this.

The Role Provider goes hand in hand with the above, because it helps you handle Roles attached to users that you have in ( They have Memberships! ).

You might want to read this: Microsoft ASP.NET 2.0 Provider Introduction from MSDN

倾城°AllureLove 2024-09-02 07:58:18

使用 Provider 模型意味着,如果您不喜欢 ASP.NET 中某些内容的工作方式或者您想要/需要扩展它,您可以编写自己的模型。只要它支持 ASP.NET 作为平台的一部分工作所需的核心功能,即继承自 MemrbershipProvider/RoleProvider/WhateverProvider,您就可以在内部做您想做的事情。
然后,您可以换出默认的提供程序并在其位置使用您的提供程序,例如,假设您不使用 SQL Server,您使用 CouchDB 来存储所有数据。您不能使用 SqlMembershipProvider,但可以编写 CouchDBMembershipProvider* - 只要您继承自 MembershipProvider 并重写其方法即可与 CouchDB 一起工作,你就可以开始了。

* 我并不是说你应该这样做,我只是说你可以:-)

Using the Provider model means that if you don't like the way something in ASP.NET works or you want/need to extend it, you can write your own. As long as it supports the core functionality that ASP.NET needs to work as part of the platform i.e. it inherits from MemrbershipProvider/RoleProvider/WhateverProvider, you can do what you want in the internals.
You can then swap out the default Provider and use yours in it's place e.g. say you don't use SQL Server, you use CouchDB for all your data storage. You can't use the SqlMembershipProvider, but you can write a CouchDBMembershipProvider* - as long as you inherit from MembershipProvider and override its' methods to work with CouchDB you're good to go.

* I'm not saying you should do this, I'm just saying you can :-)

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