Exemple #1
0
 protected override IEnumerable<Table> OnBuild()
 {
     foreach (var entity in BluePrint.Entities)
     {
         var factory = new AnchorFactory();
         var keyColumns = entity.Key.Attributes.Select(k => new ColumnFactory().Build(k.Label, k.DataType, k.IsNullable));
         var anchor = factory.Build(entity.Label, keyColumns);
         yield return anchor;
     }
 }
Exemple #2
0
        public void Build_EntityWithOneBK_Anchor()
        {
            var factory = new AnchorFactory();
            var anchor = factory.Build("Student", new List<Tuple<string, string>>() { new Tuple<string, string>("StudentNr", "char(10)") });

            Assert.IsInstanceOfType(anchor, typeof(Anchor));
            Assert.IsNotNull(anchor);
            Assert.AreEqual("Student", anchor.Shortname);
            Assert.AreEqual("StudentNr", anchor.BusinessKey[0].Name);
            Assert.AreEqual(SqlDataType.Char, anchor.BusinessKey[0].DataType.SqlDataType);
            Assert.AreEqual(10, anchor.BusinessKey[0].DataType.Precision);
            Assert.AreEqual("StudentId", anchor.Identity.Name);
            Assert.AreEqual(SqlDataType.Int, anchor.Identity.DataType.SqlDataType);
        }