Beispiel #1
0
        public void The_Reference_Is_Added_To_Both_Sides()
        {
            var reference = entity1.CreateReferenceTo(entity2);

            Assert.That(entity1.References.Contains(reference));
            Assert.That(entity2.References.Contains(reference));
        }
Beispiel #2
0
        public void Setup()
        {
            mappingSet = new MappingSetImpl(new Database("DB1"), new EntitySetImpl());

            entity1 = new EntityImpl("Entity1");
            entity2 = new EntityImpl("Entity2");
            mappingSet.EntitySet.AddEntity(entity1);
            mappingSet.EntitySet.AddEntity(entity2);

            reference1 = entity1.CreateReferenceTo(entity2);
            var reference2 = entity1.CreateReferenceTo(entity2);

            refMapping1 = new TableReferenceMappingImpl {
                FromTable = new Table("Table2"), ToReference = reference2
            };
            var refMapping2 = new TableReferenceMappingImpl {
                FromTable = new Table("Table1"), ToReference = reference1
            };

            relMapping1 = new RelationshipReferenceMappingImpl {
                FromRelationship = new RelationshipImpl(), ToReference = reference2
            };
            var relMapping2 = new RelationshipReferenceMappingImpl {
                FromRelationship = new RelationshipImpl(), ToReference = reference1
            };

            mappingSet.AddMapping(refMapping1);
            mappingSet.AddMapping(refMapping2);

            mappingSet.AddMapping(relMapping1);
            mappingSet.AddMapping(relMapping2);
        }
Beispiel #3
0
        public void SetUp()
        {
            entities = new EntitySetImpl();

            personEntity = new EntityImpl("Person");
            personEntity.AddProperty(new PropertyImpl("ID")
            {
                Type = "int", IsKeyProperty = true
            });
            personEntity.AddProperty(new PropertyImpl("Name")
            {
                Type = "string", ValidationOptions = new ValidationOptions {
                    MaximumLength = 50
                }
            });
            personEntity.AddProperty(new PropertyImpl("Salary")
            {
                Type = "int"
            });

            managerEntity        = new EntityImpl("Manager");
            managerEntity.Parent = personEntity;

            entities.AddEntity(personEntity);
            entities.AddEntity(managerEntity);

            reference              = managerEntity.CreateReferenceTo(personEntity);
            reference.End1Enabled  = true; reference.End2Enabled = true;
            reference.End1Name     = "Subordinates"; reference.End2Name = "Manager";
            reference.Cardinality1 = Cardinality.Many; reference.Cardinality2 = Cardinality.One;
        }
Beispiel #4
0
        public void SetUp()
        {
            entities = new EntitySetImpl();

            entity1 = new EntityImpl("Entity1");
            entity1.AddProperty(new PropertyImpl("PrimaryKey")
            {
                Type = "System.Int32", IsKeyProperty = true
            });

            entity2 = new EntityImpl("Entity2");
            entity2.AddProperty(new PropertyImpl("PrimaryKey")
            {
                Type = "System.Int32", IsKeyProperty = true
            });

            entities.AddEntity(entity1);
            entities.AddEntity(entity2);

            reference = entity1.CreateReferenceTo(entity2);
            reference.Cardinality1 = Cardinality.Many;
            reference.Cardinality2 = Cardinality.Many;

            var proc = new MappingProcessor(new OneToOneEntityProcessor());

            mappingSet = proc.CreateOneToOneMapping(entities);
        }
Beispiel #5
0
        public void SetUp()
        {
            entities = new EntitySetImpl();

            entity1 = new EntityImpl("Entity1");
            entity1.AddProperty(new PropertyImpl("PrimaryKey")
            {
                Type = "System.Int32", IsKeyProperty = true
            });
            entity1.AddProperty(new PropertyImpl("Property")
            {
                Type = "bool"
            });

            entity2 = new EntityImpl("Entity2");
            entity2.AddProperty(new PropertyImpl("PrimaryKey")
            {
                Type = "System.Int32", IsKeyProperty = true
            });

            entities.AddEntity(entity1);
            entities.AddEntity(entity2);

            reference = entity1.CreateReferenceTo(entity2);
            reference.Cardinality1 = Cardinality.One;
            reference.Cardinality2 = Cardinality.One;
        }
        public void SetUp()
        {
            entity1 = new EntityImpl("Entity1");
            entity2 = new EntityImpl("Entity2");

            entitySet = new EntitySetImpl();
            entitySet.AddEntity(entity1);
            entitySet.AddEntity(entity2);

            entity1.CreateReferenceTo(entity2);
        }
        public void SetUp()
        {
            entity1 = new EntityImpl("Entity1");
            entity2 = new EntityImpl("Entity2");

            entitySet = new EntitySetImpl();
            entitySet.AddEntity(entity1);
            entitySet.AddEntity(entity2);

            entity1.CreateReferenceTo(entity2);
        }
        public void SetUp()
        {
            entities = new EntitySetImpl();

            entity1 = new EntityImpl("Entity1");
            entity1.AddProperty(new PropertyImpl("PrimaryKey") { Type = "System.Int32", IsKeyProperty = true });
            entity1.AddProperty(new PropertyImpl("Property") { Type = "bool" });

            entity2 = new EntityImpl("Entity2");
            entity2.AddProperty(new PropertyImpl("PrimaryKey") { Type = "System.Int32", IsKeyProperty = true });

            entities.AddEntity(entity1);
            entities.AddEntity(entity2);

            reference = entity1.CreateReferenceTo(entity2);
            reference.Cardinality1 = Cardinality.One;
            reference.Cardinality2 = Cardinality.One;
        }
        public void SetUp()
        {
            entities = new EntitySetImpl();

            entity1 = new EntityImpl("Entity1");
            entity1.AddProperty(new PropertyImpl("PrimaryKey") { Type = "System.Int32", IsKeyProperty = true });

            entity2 = new EntityImpl("Entity2");
            entity2.AddProperty(new PropertyImpl("PrimaryKey") { Type = "System.Int32", IsKeyProperty = true });

            entities.AddEntity(entity1);
            entities.AddEntity(entity2);

            reference = entity1.CreateReferenceTo(entity2);
            reference.Cardinality1 = Cardinality.Many;
            reference.Cardinality2 = Cardinality.Many;

            var proc = new MappingProcessor(new OneToOneEntityProcessor());
            mappingSet = proc.CreateOneToOneMapping(entities);
        }
        public void SetUp()
        {
            entities = new EntitySetImpl();

            personEntity = new EntityImpl("Person");
            personEntity.AddProperty(new PropertyImpl("ID") { Type = "int", IsKeyProperty = true });
            personEntity.AddProperty(new PropertyImpl("Name") { Type = "string", ValidationOptions = new ValidationOptions {MaximumLength = 50} });
            personEntity.AddProperty(new PropertyImpl("Salary") { Type = "int" });

            managerEntity = new EntityImpl("Manager");
            managerEntity.Parent = personEntity;

            entities.AddEntity(personEntity);
            entities.AddEntity(managerEntity);

            reference = managerEntity.CreateReferenceTo(personEntity);
            reference.End1Enabled = true; reference.End2Enabled = true;
            reference.End1Name = "Subordinates"; reference.End2Name = "Manager";
            reference.Cardinality1 = Cardinality.Many; reference.Cardinality2 = Cardinality.One;
        }
        public void Setup()
        {
            mappingSet = new MappingSetImpl(new Database("DB1"), new EntitySetImpl());

            entity1 = new EntityImpl("Entity1");
            entity2 = new EntityImpl("Entity2");
            mappingSet.EntitySet.AddEntity(entity1);
            mappingSet.EntitySet.AddEntity(entity2);

            reference1 = entity1.CreateReferenceTo(entity2);
            var reference2 = entity1.CreateReferenceTo(entity2);

            refMapping1 = new TableReferenceMappingImpl { FromTable = new Table("Table2"), ToReference = reference2 };
            var refMapping2 = new TableReferenceMappingImpl { FromTable = new Table("Table1"), ToReference = reference1 };

            relMapping1 = new RelationshipReferenceMappingImpl { FromRelationship = new RelationshipImpl(), ToReference = reference2 };
            var relMapping2 = new RelationshipReferenceMappingImpl { FromRelationship = new RelationshipImpl(), ToReference = reference1 };

            mappingSet.AddMapping(refMapping1);
            mappingSet.AddMapping(refMapping2);

            mappingSet.AddMapping(relMapping1);
            mappingSet.AddMapping(relMapping2);
        }