Example #1
0
        internal FactALInterface GetFactInterfaceFor(FactALInterface factIn)
        {
            var factOut = GetFactInterfaceByName(factIn.Name);

            if (factOut == null)
            {
                FactInterfaces.Add(factIn);
                factOut = factIn;
            }
            return(factOut);
        }
Example #2
0
        private void PrepareFactInterfaces()
        {
            FactInterfaces      = new List <FactALInterface>();
            DimensionInterfaces = new List <DimensionALInterface>();

            var factBT = parent.Interfaces
                         .Where(i => i.InterfaceType == Core.CoreInterfaceType.FACT_TABLE)
                         .OrderByDescending(i => i.blInterface.MaxReferenceDepth)
            ;

            foreach (var f in factBT)
            {
                var fIfa = new FactALInterface(f, this);
                if (this.GetFactInterfaceByName(fIfa.Name) == null)
                {
                    FactInterfaces.Add(fIfa);
                }
            }
        }
Example #3
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;
                }
            }
        }