惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
美团技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 中国Rainbow

dudu你真了不起! 中国DNN开通了『模块演示』栏目 DNN3.3.1 &4.3.1简体中文语言包发布 6月28日 中国DNN启用太阳网服务器-中国DNN的第三次邀请(更新) 好久没有写东西,今天报个到! 感恩的心 萍聚 把根留住 开始翻译DotNetNuke 3.0 Module Developer’s Guide-目录 请下载DotNetNue的技术文档DotNetNuke Code Access Security中文翻译稿 System.Xml 命名空间 sestem.Web 命名空间 System.Configuration 命名空间 System.Collections.Specialized 命名空间 System.Collections 命名空间 System.IO 命名空间 System 命名空间 DNN如何加载Provider信息 DNN的数据访问配置
DNN的数据访问的抽象类
中国Rainbow · 2005-06-30 · via 博客园 - 中国Rainbow

DNN的数据访问的抽象类在\Components\Providers\Data\DataProvider.vb,包括DNN的所有数据访问方法。其中 Instance()就是 factory自己,并且通过WEB.CONFIG加载相应的程序集。
 

        ' provider constants - eliminates need for Reflection later

        Private Const [ProviderType] As String = "data" ' maps to <sectionGroup> in web.config

        ' create a variable to store the reference to the instantiated object

        Private Shared objProvider As DataProvider

        Public Shared Function Instance() As DataProvider

            ' does the provider reference already exist?

            If objProvider Is Nothing Then

                Dim strCacheKey As String = [ProviderType] & "provider"

                ' use the cache because the reflection used later is expensive

                Dim objType As Type = CType(DataCache.GetCache(strCacheKey), Type)

                If objType Is Nothing Then

                    ' Get the provider configuration based on the type

                    Dim objProviderConfiguration As ProviderConfiguration = ProviderConfiguration.GetProviderConfiguration([ProviderType])

                    ' The assembly should be in \bin or GAC, so we simply need to get an instance of the type

                    Try

                        ' Get the typename of the Core DataProvider from web.config

                        Dim strTypeName As String = CType(objProviderConfiguration.Providers(objProviderConfiguration.DefaultProvider), Provider).Type

                        ' use reflection to get the type of the class that implements the provider

                        objType = Type.GetType(strTypeName, True)

                        ' 把类型插入到缓存

                        DataCache.SetCache(strCacheKey, objType)

                    Catch e As Exception

                        ' Could not load the provider - this is likely due to binary compatibility issues

                    End Try

                End If

                ' 保存引用

                objProvider = CType(Activator.CreateInstance(objType), DataProvider)

            End If

            Return objProvider

        End Function
所有的方法都要求重写,也就是说相关的调用都必须重写这个方法。
 

        ' 链接模块

        Public MustOverride Function GetLinks(ByVal ModuleId As Integer) As IDataReader

        Public MustOverride Function GetLink(ByVal ItemID As Integer, ByVal ModuleId As Integer) As IDataReader

        Public MustOverride Sub DeleteLink(ByVal ItemID As Integer)

        Public MustOverride Sub AddLink(ByVal ModuleId As Integer, ByVal UserName As String, ByVal Title As String, ByVal Url As String, ByVal MobileUrl As String, ByVal ViewOrder As String, ByVal Description As String, ByVal NewWindow As Boolean)

        Public MustOverride Sub UpdateLink(ByVal ItemId As Integer, ByVal UserName As String, ByVal Title As String, ByVal Url As String, ByVal MobileUrl As String, ByVal ViewOrder As String, ByVal Description As String, ByVal NewWindow As Boolean)