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

推荐订阅源

A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
月光博客
月光博客
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
博客园 - 叶小钗
博客园 - 司徒正美
美团技术团队
博客园_首页
宝玉的分享
宝玉的分享
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News

博客园 - 中国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)