First Version with Template Config from Database
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Namespace Schemas
|
||||
Imports MultiTool.Shared.Winline
|
||||
|
||||
Namespace Schemas
|
||||
Public Class Schema
|
||||
Public Property Tables As New List(Of Table)
|
||||
Public Property Name As String
|
||||
@@ -10,8 +12,9 @@
|
||||
|
||||
Class Column
|
||||
Public Property Name As String
|
||||
Public Property Required As String
|
||||
Public Property DataType As Constants.ColumnType
|
||||
Public Property IsRequired As Boolean
|
||||
Public Property Config As ColumnConfig
|
||||
End Class
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
@@ -63,8 +63,8 @@ Namespace Schemas
|
||||
|
||||
Dim oSchemaColumn As New Schema.Column With {
|
||||
.Name = oName,
|
||||
.Required = oRequired,
|
||||
.DataType = oType
|
||||
.DataType = oType,
|
||||
.IsRequired = oRequired
|
||||
}
|
||||
oSchemaColumns.Add(oSchemaColumn)
|
||||
Next
|
||||
@@ -79,6 +79,21 @@ Namespace Schemas
|
||||
Return oSchema
|
||||
End Function
|
||||
|
||||
Public Function UpdateSchemaWithDatabaseConfiguration(pSchema As Schema, pTemplateConfig As Winline.Configuration) As Schema
|
||||
If pTemplateConfig Is Nothing Then
|
||||
Return pSchema
|
||||
End If
|
||||
|
||||
For Each oTable In pSchema.Tables
|
||||
For Each oColumn As Schema.Column In oTable.Columns
|
||||
Dim oConfig = pTemplateConfig.GetColumn(oColumn.Name)
|
||||
oColumn.Config = oConfig
|
||||
Next
|
||||
Next
|
||||
|
||||
Return pSchema
|
||||
End Function
|
||||
|
||||
Public Function GetElementType(pElement As XElement) As Constants.ColumnType
|
||||
Dim oTypeString = XmlData.GetElementAttribute(pElement, "type")
|
||||
|
||||
@@ -91,13 +106,13 @@ Namespace Schemas
|
||||
End If
|
||||
|
||||
Select Case oTypeString
|
||||
Case "xs:date"
|
||||
Case Constants.SCHEMA_TYPE_DATE
|
||||
Return Constants.ColumnType.Date
|
||||
Case "xs:integer"
|
||||
Case Constants.SCHEMA_TYPE_INTEGER
|
||||
Return Constants.ColumnType.Integer
|
||||
Case "xs:decimal"
|
||||
Case Constants.SCHEMA_TYPE_DECIMAL
|
||||
Return Constants.ColumnType.Decimal
|
||||
Case "xs:boolean"
|
||||
Case Constants.SCHEMA_TYPE_BOOLEAN
|
||||
Return Constants.ColumnType.Boolean
|
||||
Case Else
|
||||
Return Constants.ColumnType.String
|
||||
|
||||
Reference in New Issue
Block a user