转自:http://www.cnblogs.com/Bruce_H21/archive/2005/07/22/197932.html 前一阵子抽了一些时间看了一下缩水版的DNN(starter kit)---- [从二十四画生那里请教的DNN的学习方法]。 其中portal的用户配置文件portalCfg.xml还有该文件的操作类portalCfg.vb是实现灵活页面布局的关键。一开始觉得写操作类的portalCfg.vb文件很难,而且那么长的代码文件差不多2k多行,仔细看portalCfg.vb文件的头部包含这样的注释 :
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a tool.
' Runtime Version: 1.0.3705.209
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
因为对XML了解不深,查找一些资料才发现原来portalCfg.vb文件根本不用手写,用生成就可以了,无论是xml或config文件都可。 随便找简单的几行代码先试试 建立一个sample.xml 代码如下
<?xml version="1.0" encoding="utf-8" ?>
<SiteConfiguration>
<Module ModuleId="1" ModuleTitle="快速連結" EditRoles="Admins;" ModuleDefId="8" PaneName="LeftPane" CacheTimeout="0" ModuleOrder="1" ShowMobile="false" />
<Module ModuleId="2" ModuleTitle="歡迎使用入口網站入門套件 (Portal Starter Kit)" EditRoles="Admins;" ModuleDefId="5" PaneName="ContentPane" CacheTimeout="0" ModuleOrder="1" ShowMobile="true" />
</SiteConfiguration>
然后在VS2003 里面 按mouse右键 --〉生成架构 你会发现项目中会多出一个 sample.xsd的文件而且你的portalCfg.xml的文件也变成如下
<?xml version="1.0" encoding="utf-8"?>
<SiteConfiguration xmlns="http://tempuri.org/sample.xsd">
<Module ModuleId="1" ModuleTitle="快速連結" EditRoles="Admins;" ModuleDefId="8" PaneName="LeftPane" CacheTimeout="0" ModuleOrder="1" ShowMobile="false" />
<Module ModuleId="2" ModuleTitle="歡迎使用入口網站入門套件 (Portal Starter Kit)" EditRoles="Admins;" ModuleDefId="5" PaneName="ContentPane" CacheTimeout="0" ModuleOrder="1" ShowMobile="true" />
</SiteConfiguration>
portal.xsd的代码
<?xml version="1.0"?>
<xs:schema id="SiteConfiguration" targetNamespace="http://tempuri.org/sample.xsd" xmlns:mstns="http://tempuri.org/sample.xsd" xmlns="http://tempuri.org/sample.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="SiteConfiguration" msdata:IsDataSet="true" msdata:Locale="zh-CN" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Module">
<xs:complexType>
<xs:attribute name="ModuleId" form="unqualified" type="xs:string" />
<xs:attribute name="ModuleTitle" form="unqualified" type="xs:string" />
<xs:attribute name="EditRoles" form="unqualified" type="xs:string" />
<xs:attribute name="ModuleDefId" form="unqualified" type="xs:string" />
<xs:attribute name="PaneName" form="unqualified" type="xs:string" />
<xs:attribute name="CacheTimeout" form="unqualified" type="xs:string" />
<xs:attribute name="ModuleOrder" form="unqualified" type="xs:string" />
<xs:attribute name="ShowMobile" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
然后打开sample.xsd文件 --〉在数据集模式下面按mouse右键--〉生成数据集 sample.vb代码就出来了。
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a tool.
' Runtime Version: 1.1.4322.573
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.Data
Imports System.Runtime.Serialization
Imports System.Xml
<Serializable(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Diagnostics.DebuggerStepThrough(), _
System.ComponentModel.ToolboxItem(true)> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) Public Class SiteConfigurationClass SiteConfiguration
Inherits DataSet
Private table_Module As _ModuleDataTable
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub New()Sub New()
MyBase.New
Me.InitClass
Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
AddHandler Me.Tables.CollectionChanged, schemaChangedHandler
AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Sub New()Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New
Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String)
If (Not (strSchema) Is Nothing) Then
Dim ds As DataSet = New DataSet
ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema)))
If (Not (ds.Tables("Module")) Is Nothing) Then
Me.Tables.Add(New _ModuleDataTable(ds.Tables("Module")))
End If
Me.DataSetName = ds.DataSetName
Me.Prefix = ds.Prefix
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.Namespace =Namespace = ds.Namespace MeNamespace
Me.Locale = ds.Locale
Me.CaseSensitive = ds.CaseSensitive
Me.EnforceConstraints = ds.EnforceConstraints
Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)
Me.InitVars
Else
Me.InitClass
End If
Me.GetSerializationData(info, context)
Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
AddHandler Me.Tables.CollectionChanged, schemaChangedHandler
AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
End Sub
<System.ComponentModel.Browsable(false), _
System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public ReadOnly Property _Module()Property _Module As _ModuleDataTable
Get
Return Me.table_Module
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Overrides Function Clone()Function Clone() As DataSet
Dim cln As SiteConfiguration = CType(MyBase.Clone,SiteConfiguration)
cln.InitVars
Return cln
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function ShouldSerializeTables()Function ShouldSerializeTables() As Boolean
Return false
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function ShouldSerializeRelations()Function ShouldSerializeRelations() As Boolean
Return false
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Sub ReadXmlSerializable()Sub ReadXmlSerializable(ByVal reader As XmlReader)
Me.Reset
Dim ds As DataSet = New DataSet
ds.ReadXml(reader)
If (Not (ds.Tables("Module")) Is Nothing) Then
Me.Tables.Add(New _ModuleDataTable(ds.Tables("Module")))
End If
Me.DataSetName = ds.DataSetName
Me.Prefix = ds.Prefix
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.Namespace =Namespace = ds.Namespace MeNamespace
Me.Locale = ds.Locale
Me.CaseSensitive = ds.CaseSensitive
Me.EnforceConstraints = ds.EnforceConstraints
Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)
Me.InitVars
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function GetSchemaSerializable()Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing))
stream.Position = 0
Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend Sub InitVars()Sub InitVars()
Me.table_Module = CType(Me.Tables("Module"),_ModuleDataTable)
If (Not (Me.table_Module) Is Nothing) Then
Me.table_Module.InitVars
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Private Sub InitClass()Sub InitClass()
Me.DataSetName = "SiteConfiguration"
Me.Prefix = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.Namespace =Namespace = "http://tempuri.org/sample.xsd"
Me.Locale = New System.Globalization.CultureInfo("zh-CN")
Me.CaseSensitive = false
Me.EnforceConstraints = false
Me.table_Module = New _ModuleDataTable
Me.Tables.Add(Me.table_Module)
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Private Function ShouldSerialize_Module()Function ShouldSerialize_Module() As Boolean
Return false
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Private Sub SchemaChanged()Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs)
If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then
Me.InitVars
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Delegate Sub _ModuleRowChangeEventHandler()Sub _ModuleRowChangeEventHandler(ByVal sender As Object, ByVal e As _ModuleRowChangeEvent)
<System.Diagnostics.DebuggerStepThrough()> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Class _ModuleDataTableClass _ModuleDataTable
Inherits DataTable
Implements System.Collections.IEnumerable
Private columnModuleId As DataColumn
Private columnModuleTitle As DataColumn
Private columnEditRoles As DataColumn
Private columnModuleDefId As DataColumn
Private columnPaneName As DataColumn
Private columnCacheTimeout As DataColumn
Private columnModuleOrder As DataColumn
Private columnShowMobile As DataColumn
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend Sub New()Sub New()
MyBase.New("Module")
Me.InitClass
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend Sub New()Sub New(ByVal table As DataTable)
MyBase.New(table.TableName)
If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
Me.CaseSensitive = table.CaseSensitive
End If
If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
Me.Locale = table.Locale
End If
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) If (table.Namespace Namespace <> table.DataSet.Namespace )Namespace) Then
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.Namespace =Namespace = table.Namespace EndNamespace
End If
Me.Prefix = table.Prefix
Me.MinimumCapacity = table.MinimumCapacity
Me.DisplayExpression = table.DisplayExpression
End Sub
<System.ComponentModel.Browsable(false)> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public ReadOnly Property Count()Property Count As Integer
Get
Return Me.Rows.Count
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property ModuleIdColumn()Property ModuleIdColumn As DataColumn
Get
Return Me.columnModuleId
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property ModuleTitleColumn()Property ModuleTitleColumn As DataColumn
Get
Return Me.columnModuleTitle
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property EditRolesColumn()Property EditRolesColumn As DataColumn
Get
Return Me.columnEditRoles
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property ModuleDefIdColumn()Property ModuleDefIdColumn As DataColumn
Get
Return Me.columnModuleDefId
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property PaneNameColumn()Property PaneNameColumn As DataColumn
Get
Return Me.columnPaneName
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property CacheTimeoutColumn()Property CacheTimeoutColumn As DataColumn
Get
Return Me.columnCacheTimeout
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property ModuleOrderColumn()Property ModuleOrderColumn As DataColumn
Get
Return Me.columnModuleOrder
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend ReadOnly Property ShowMobileColumn()Property ShowMobileColumn As DataColumn
Get
Return Me.columnShowMobile
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Default ReadOnly Property Item()Property Item(ByVal index As Integer) As _ModuleRow
Get
Return CType(Me.Rows(index),_ModuleRow)
End Get
End Property
Public Event _ModuleRowChanged As _ModuleRowChangeEventHandler
Public Event _ModuleRowChanging As _ModuleRowChangeEventHandler
Public Event _ModuleRowDeleted As _ModuleRowChangeEventHandler
Public Event _ModuleRowDeleting As _ModuleRowChangeEventHandler
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Overloads Sub Add_ModuleRow()Sub Add_ModuleRow(ByVal row As _ModuleRow)
Me.Rows.Add(row)
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Overloads Function Add_ModuleRow()Function Add_ModuleRow(ByVal ModuleId As String, ByVal ModuleTitle As String, ByVal EditRoles As String, ByVal ModuleDefId As String, ByVal PaneName As String, ByVal CacheTimeout As String, ByVal ModuleOrder As String, ByVal ShowMobile As String) As _ModuleRow
Dim row_ModuleRow As _ModuleRow = CType(Me.NewRow,_ModuleRow)
row_ModuleRow.ItemArray = New Object() {ModuleId, ModuleTitle, EditRoles, ModuleDefId, PaneName, CacheTimeout, ModuleOrder, ShowMobile}
Me.Rows.Add(row_ModuleRow)
Return row_ModuleRow
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function GetEnumerator()Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Overrides Function Clone()Function Clone() As DataTable
Dim cln As _ModuleDataTable = CType(MyBase.Clone,_ModuleDataTable)
cln.InitVars
Return cln
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function CreateInstance()Function CreateInstance() As DataTable
Return New _ModuleDataTable
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend Sub InitVars()Sub InitVars()
Me.columnModuleId = Me.Columns("ModuleId")
Me.columnModuleTitle = Me.Columns("ModuleTitle")
Me.columnEditRoles = Me.Columns("EditRoles")
Me.columnModuleDefId = Me.Columns("ModuleDefId")
Me.columnPaneName = Me.Columns("PaneName")
Me.columnCacheTimeout = Me.Columns("CacheTimeout")
Me.columnModuleOrder = Me.Columns("ModuleOrder")
Me.columnShowMobile = Me.Columns("ShowMobile")
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Private Sub InitClass()Sub InitClass()
Me.columnModuleId = New DataColumn("ModuleId", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnModuleId)
Me.columnModuleTitle = New DataColumn("ModuleTitle", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnModuleTitle)
Me.columnEditRoles = New DataColumn("EditRoles", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnEditRoles)
Me.columnModuleDefId = New DataColumn("ModuleDefId", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnModuleDefId)
Me.columnPaneName = New DataColumn("PaneName", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnPaneName)
Me.columnCacheTimeout = New DataColumn("CacheTimeout", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnCacheTimeout)
Me.columnModuleOrder = New DataColumn("ModuleOrder", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnModuleOrder)
Me.columnShowMobile = New DataColumn("ShowMobile", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
Me.Columns.Add(Me.columnShowMobile)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnModuleId.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnModuleTitle.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnEditRoles.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnModuleDefId.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnPaneName.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnCacheTimeout.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnModuleOrder.Namespace =Namespace = ""
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Me.columnShowMobile.Namespace =Namespace = ""
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function New_ModuleRow()Function New_ModuleRow() As _ModuleRow
Return CType(Me.NewRow,_ModuleRow)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function NewRowFromBuilder()Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New _ModuleRow(builder)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Function GetRowType()Function GetRowType() As System.Type
Return GetType(_ModuleRow)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Sub OnRowChanged()Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me._ModuleRowChangedEvent) Is Nothing) Then
RaiseEvent _ModuleRowChanged(Me, New _ModuleRowChangeEvent(CType(e.Row,_ModuleRow), e.Action))
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Sub OnRowChanging()Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me._ModuleRowChangingEvent) Is Nothing) Then
RaiseEvent _ModuleRowChanging(Me, New _ModuleRowChangeEvent(CType(e.Row,_ModuleRow), e.Action))
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Sub OnRowDeleted()Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me._ModuleRowDeletedEvent) Is Nothing) Then
RaiseEvent _ModuleRowDeleted(Me, New _ModuleRowChangeEvent(CType(e.Row,_ModuleRow), e.Action))
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Protected Overrides Sub OnRowDeleting()Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me._ModuleRowDeletingEvent) Is Nothing) Then
RaiseEvent _ModuleRowDeleting(Me, New _ModuleRowChangeEvent(CType(e.Row,_ModuleRow), e.Action))
End If
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub Remove_ModuleRow()Sub Remove_ModuleRow(ByVal row As _ModuleRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Class _ModuleRowClass _ModuleRow
Inherits DataRow
Private table_Module As _ModuleDataTable
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Friend Sub New()Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.table_Module = CType(Me.Table,_ModuleDataTable)
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property ModuleId()Property ModuleId As String
Get
Try
Return CType(Me(Me.table_Module.ModuleIdColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.ModuleIdColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property ModuleTitle()Property ModuleTitle As String
Get
Try
Return CType(Me(Me.table_Module.ModuleTitleColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.ModuleTitleColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property EditRoles()Property EditRoles As String
Get
Try
Return CType(Me(Me.table_Module.EditRolesColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.EditRolesColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property ModuleDefId()Property ModuleDefId As String
Get
Try
Return CType(Me(Me.table_Module.ModuleDefIdColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.ModuleDefIdColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property PaneName()Property PaneName As String
Get
Try
Return CType(Me(Me.table_Module.PaneNameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.PaneNameColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property CacheTimeout()Property CacheTimeout As String
Get
Try
Return CType(Me(Me.table_Module.CacheTimeoutColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.CacheTimeoutColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property ModuleOrder()Property ModuleOrder As String
Get
Try
Return CType(Me(Me.table_Module.ModuleOrderColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.ModuleOrderColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Property ShowMobile()Property ShowMobile As String
Get
Try
Return CType(Me(Me.table_Module.ShowMobileColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("无法获取值,因为它是 DBNull。", e)
End Try
End Get
Set
Me(Me.table_Module.ShowMobileColumn) = value
End Set
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsModuleIdNull()Function IsModuleIdNull() As Boolean
Return Me.IsNull(Me.table_Module.ModuleIdColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetModuleIdNull()Sub SetModuleIdNull()
Me(Me.table_Module.ModuleIdColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsModuleTitleNull()Function IsModuleTitleNull() As Boolean
Return Me.IsNull(Me.table_Module.ModuleTitleColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetModuleTitleNull()Sub SetModuleTitleNull()
Me(Me.table_Module.ModuleTitleColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsEditRolesNull()Function IsEditRolesNull() As Boolean
Return Me.IsNull(Me.table_Module.EditRolesColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetEditRolesNull()Sub SetEditRolesNull()
Me(Me.table_Module.EditRolesColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsModuleDefIdNull()Function IsModuleDefIdNull() As Boolean
Return Me.IsNull(Me.table_Module.ModuleDefIdColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetModuleDefIdNull()Sub SetModuleDefIdNull()
Me(Me.table_Module.ModuleDefIdColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsPaneNameNull()Function IsPaneNameNull() As Boolean
Return Me.IsNull(Me.table_Module.PaneNameColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetPaneNameNull()Sub SetPaneNameNull()
Me(Me.table_Module.PaneNameColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsCacheTimeoutNull()Function IsCacheTimeoutNull() As Boolean
Return Me.IsNull(Me.table_Module.CacheTimeoutColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetCacheTimeoutNull()Sub SetCacheTimeoutNull()
Me(Me.table_Module.CacheTimeoutColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsModuleOrderNull()Function IsModuleOrderNull() As Boolean
Return Me.IsNull(Me.table_Module.ModuleOrderColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetModuleOrderNull()Sub SetModuleOrderNull()
Me(Me.table_Module.ModuleOrderColumn) = System.Convert.DBNull
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Function IsShowMobileNull()Function IsShowMobileNull() As Boolean
Return Me.IsNull(Me.table_Module.ShowMobileColumn)
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub SetShowMobileNull()Sub SetShowMobileNull()
Me(Me.table_Module.ShowMobileColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Class _ModuleRowChangeEventClass _ModuleRowChangeEvent
Inherits EventArgs
Private eventRow As _ModuleRow
Private eventAction As DataRowAction
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public Sub New()Sub New(ByVal row As _ModuleRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public ReadOnly Property Row()Property Row As _ModuleRow
Get
Return Me.eventRow
End Get
End Property
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Public ReadOnly Property Action()Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
这样的话就方便了。用这种方法重新生成portalCfg.vb 发现生成的代码也只比原来的少了几个简单的方法而已。 好了也算是学习DNN的一个小小的收获。贴出来如有不妥请大家指教。
发表于
2006-04-20 10:40
欢欢
阅读( 435)
评论()
编辑
收藏
举报
|
|