Exemple #1
0
        private IBTAttribute CreateVersionKNZAttribute(BaseBLAttribute pk)
        {
            string ifaName   = pk.GetILAttribute().Core.ParentInterface.Name;
            string fieldName = pk.GetILAttribute().Core.Name;

            return(new BaseBTAttribute($"{ifaName}_VERSION_{fieldName}", pk, this));
        }
Exemple #2
0
        public RefBTAttribute(RefBLAttribute blAttribute, BTInterface ifa)
        {
            this.blAttribute         = blAttribute;
            this.refBLAttribute      = blAttribute;
            this.otherBlAttribute    = null;
            this.ParentInterface     = ifa;
            this.IsIdentity          = blAttribute.IsIdentity;
            this.IsPartOfUniqueKey   = blAttribute.IsPartOfUniqueKey;
            this.HasToUseVerionTable = GetHasToUseVersionTable();

            if (HasToUseVerionTable)
            {
                // Wenn das aktuelle Interface keine FactTable ist und beide eine Historie haben,
                // dann wird die Beziehung über die Historientabellen aufgelöst
                var blModel = blAttribute.ParentInterface.ParentModel;
                this.ReferencedBLInterface = blModel.Interfaces.Single(i => i.Name == blAttribute.ReferencedAttribute.ParentInterface.Name + "_VERSION");
                this.ReferencedBLAttribute = this.ReferencedBLInterface.Attributes.Single(a => a.IsPartOfUniqueKey && !a.IsTechnicalAttribute && a.Name != "Mandant_KNZ");
            }
            else
            {
                // ansonsten wird die Tabelle ohne Historie verwendet.
                this.ReferencedBLAttribute = blAttribute.ReferencedAttribute;
                this.ReferencedBLInterface = blAttribute.ReferencedAttribute.ParentInterface;
            }

            this.IdAttribute  = new IdSubAttribute(this);
            this.KnzAttribute = new KnzSubAttribute(this);
        }
        public void TestBaseBLAttribute_ByCoreBaseAttribute()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\interface_demo.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            // Auswählen
            var coreIfa  = model.Interfaces[0];
            var coreAttr = coreIfa.Attributes[0];
            var blIfa    = new DefaultBLInterface(coreIfa, null);

            // In BaseBLAttribute konvertieren
            BaseBLAttribute attr = new BaseBLAttribute((CoreBaseAttribute)coreAttr, blIfa);

            // Inhalt überprüfen
            Assert.AreEqual("Semester_KNZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KNZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(50, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsTrue(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);
        }
Exemple #4
0
        ///
        /// Wichtig: nur in BT zur Abbildung der History-Beziehung nutzen!
        ///
        internal RefBTAttribute(BaseBLAttribute blAttribute, IBLInterface blIfa, BTInterface ifa)
        {
            this.blAttribute         = blAttribute;
            this.refBLAttribute      = null;
            this.otherBlAttribute    = blAttribute;
            this.ParentInterface     = ifa;
            this.IsIdentity          = otherBlAttribute.IsIdentity;
            this.IsPartOfUniqueKey   = otherBlAttribute.IsPartOfUniqueKey;
            this.HasToUseVerionTable = false; // TODO: Das ist noch nicht sicher !

            var blModel = blAttribute.ParentInterface.ParentModel;

            this.ReferencedBLInterface = blIfa;
            this.ReferencedBLAttribute = blIfa.Attributes.Single(a => a.IsPartOfUniqueKey && (a is BaseBLAttribute));

            this.IdAttribute  = new IdSubAttribute(this);
            this.KnzAttribute = new KnzSubAttribute(this);
        }
Exemple #5
0
 public BaseBTAttribute(string name, BaseBLAttribute blAttribute, BTInterface ifa)
 {
     this.blAttribute     = blAttribute;
     this.ParentInterface = ifa;
     Name = name;
 }
Exemple #6
0
 public BaseBTAttribute(BaseBLAttribute blAttribute, BTInterface ifa)
 {
     this.blAttribute     = blAttribute;
     this.ParentInterface = ifa;
     SetName();
 }
Exemple #7
0
 private IBTAttribute CreateNonVersionedRefAttribute(BaseBLAttribute pk, DerivedBLInterface ifa)
 {
     return(new RefBTAttribute(pk, ifa.DefaultInterface, this));
 }