Fix a bug where virtual columns were created from other tables
This commit is contained in:
parent
b6801ab486
commit
8180c65ccd
@ -259,21 +259,25 @@ Namespace Templates
|
||||
End Function
|
||||
|
||||
Private Function CreateVirtualColumns(pTemplate As Template, pTemplateConfig As TemplateConfig) As Template
|
||||
For Each oConfigItem In pTemplateConfig.Items
|
||||
Dim oTemplateItems = pTemplateConfig.Items.
|
||||
Where(Function(item) item.Template = pTemplate.Name).
|
||||
ToList()
|
||||
|
||||
For Each oItem In oTemplateItems
|
||||
' Find the table that relates to this config item
|
||||
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oConfigItem.Table).FirstOrDefault()
|
||||
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oItem.Table).FirstOrDefault()
|
||||
|
||||
If oTable Is Nothing Then
|
||||
Logger.Warn("Table [{0}] for item [{1}] does exist in this Template!", oConfigItem.Table, oConfigItem.Name)
|
||||
Logger.Warn("Table [{0}] for item [{1}] does exist in this Template!", oItem.Table, oItem.Name)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oColumnExists = oTable.Columns.Any(Function(column) column.Name = oConfigItem.Name)
|
||||
Dim oColumnExists = oTable.Columns.Any(Function(column) column.Name = oItem.Name)
|
||||
|
||||
If oColumnExists = False And oConfigItem.IsVirtual = True Then
|
||||
If oColumnExists = False And oItem.IsVirtual = True Then
|
||||
oTable.Columns.Add(New Template.Column() With {
|
||||
.Name = oConfigItem.Name,
|
||||
.Config = oConfigItem,
|
||||
.Name = oItem.Name,
|
||||
.Config = oItem,
|
||||
.DataType = Constants.ColumnType.String,
|
||||
.IsRequired = False
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user