Exemplo n.º 1
0
        public IALAttribute Clone(IALInterface newParent)
        {
            var clone = new RefALAttribute(newParent, ReferencedDimension, (RefBTAttribute)BTAttribute);

            clone.Name = this.Name;
            return(clone);
        }
Exemplo n.º 2
0
        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;
                }
            }
        }