private string CalculateAlias(ALModel model, BT.RefBTAttribute refAttr) { if (string.IsNullOrEmpty(refAttr?.refBLAttribute?.Core?.Alias)) { return(""); } else { return($"{refAttr.refBLAttribute.Core.Alias}_"); } }
public DimensionALInterface(ALModel model, BT.RefBTAttribute refAttr) { this.Model = model; this.BTInterface = refAttr.ReferencedBTInterface; this.Core = refAttr.ReferencedBTInterface.coreInterface; this.Depth = 1; this.RootDimension = this; this.Alias = CalculateAlias(model, refAttr); this.ShortName = CalculateShortName(model, refAttr); this.Name = CalculateName(model, refAttr); PrepareAttributes(); }
private string CalculateName(ALModel model, BT.RefBTAttribute refAttr) { string name = ""; if (string.IsNullOrEmpty(model.Config.Prefix)) { name = $"D_"; } else { name = $"{model.Config.Prefix}_D_"; } name += $"{RootDimension.ShortName}_{Depth}_{this.ShortName}"; return(name); }
internal DimensionALInterface(ALModel model, BT.RefBTAttribute refAttr, DimensionALInterface rootDimension, int depth) { if (rootDimension == null) { rootDimension = this; } this.Model = model; this.BTInterface = refAttr.ReferencedBTInterface; this.Core = refAttr.ReferencedBTInterface.coreInterface; this.Depth = depth; this.RootDimension = rootDimension; this.Alias = CalculateAlias(model, refAttr); this.ShortName = CalculateShortName(model, refAttr); this.Name = CalculateName(model, refAttr); PrepareAttributes(); }
private string CalculateShortName(ALModel model, BT.RefBTAttribute refAttr) { if (string.IsNullOrEmpty(refAttr?.refBLAttribute?.Core?.Alias) && refAttr.ReferencedBTInterface.IsHistoryTable) { return($"{refAttr.ReferencedBTInterface.ShortName}_VERSION"); } else if (string.IsNullOrEmpty(refAttr?.refBLAttribute?.Core?.Alias)) { return(refAttr.ReferencedBTInterface.ShortName); } else if (refAttr.ReferencedBTInterface.IsHistoryTable) { return($"{refAttr.refBLAttribute.Core.Alias}_{refAttr.ReferencedBTInterface.ShortName}_VERSION"); } else { return($"{refAttr.refBLAttribute.Core.Alias}_{refAttr.ReferencedBTInterface.ShortName}"); } }
private void PrepareRefAttribute(BT.RefBTAttribute refAttr) { if (refAttr.ReferencedBTInterface.InterfaceType == CoreInterfaceType.FACT_TABLE) { var child = new FactALInterface(refAttr.ReferencedBTInterface, Model); child = Model.GetFactInterfaceFor(child); joinIdx += 1; var joinAlias = $"t{joinIdx}"; this.FactInterfaceReferences.Add(new FactInterfaceReference() { BTInterface = refAttr.ReferencedBTInterface, JoinAlias = joinAlias, RefColumnName = refAttr.IdAttribute.Name }); // Alle Attribute der Kind-Fakttabelle übernehmen // (ohne Fakten, Historisierungsattribut und Mandant-Spalte) foreach (var attr in child.Attributes.Where(a => !a.IsFact && a.Name != "Mandant_ID" && a != child.HistoryAttribute)) { var clone = attr.Clone(this); clone.JoinAlias = joinAlias; Attributes.Add(clone); } } else { var dim = new DimensionALInterface(Model, refAttr); dim = Model.GetDimensionInterfaceFor(dim); var refAlAttr = new RefALAttribute(this, dim, refAttr); refAlAttr.JoinAlias = "t0"; Attributes.Add(refAlAttr); // Wenn es sich hier um das Historienattribut handelt, merken if (refAttr?.ParentInterface?.blInterface?.HistoryAttribute != null && refAttr?.ParentInterface?.blInterface?.HistoryAttribute == refAttr.blAttribute) { HistoryAttribute = refAlAttr; } } }
public RefALAttribute(IALInterface parentInterface, DimensionALInterface referencedDim, BT.RefBTAttribute btAttribute) { this.ParentInterface = parentInterface; this.ReferencedDimension = referencedDim; this.BTAttribute = btAttribute; this.Name = ReferencedDimension.IdColumn.Name; }