Exemple #1
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);
        }
Exemple #2
0
        public void Setup()
        {
            mappingSet = new MappingSetImpl();

            table1 = new Table("Table1");
            var table2 = new Table("Table2");

            mapping3 = new MappingImpl {
                FromTable = table2
            };
            refMapping1 = new TableReferenceMappingImpl {
                FromTable = table2, ToReference = new ReferenceImpl()
            };

            mappingSet.AddMapping(new MappingImpl {
                FromTable = table1
            });
            mappingSet.AddMapping(new MappingImpl {
                FromTable = table1
            });
            mappingSet.AddMapping(mapping3);
            mappingSet.AddMapping(refMapping1);
            mappingSet.AddMapping(new TableReferenceMappingImpl {
                FromTable = table1, ToReference = new ReferenceImpl()
            });
        }
        public void RemoveMapping(TableReferenceMapping mapping)
        {
            if (referenceMappings.Remove(mapping))
            {
                mapping.MappingSet = null;
            }

            CacheInvalid = true;
            RaisePropertyChanged("ReferenceMappings");
        }
        public void AddMapping(TableReferenceMapping mapping)
        {
            if (referenceMappings.Contains(mapping))
            {
                return;
            }

            referenceMappings.Add(mapping);
            mapping.MappingSet = this;
            CacheInvalid       = true;
            RaisePropertyChanged("ReferenceMappings");
        }
Exemple #5
0
        private void SerialiseReferenceMappingInternal(TableReferenceMapping mapping, XmlWriter writer)
        {
            if (mapping.FromTable == null)
            {
                throw new ArgumentNullException("mapping", string.Format("mapping.FromTable cannot be null [{0}]", mapping.DisplayName));
            }
            if (mapping.ToReference == null)
            {
                throw new ArgumentNullException("mapping", string.Format("mapping.ToReference cannot be null [{0}]", mapping.DisplayName));
            }

            WriterHelper document = new WriterHelper(writer);

            using (document.Element("TableReferenceMapping"))
            {
                writer.WriteElementString("FromTable", mapping.FromTable.Name);
                writer.WriteElementString("FromSchema", mapping.FromTable.Schema);
                writer.WriteElementString("ToReference", mapping.ToReference.Identifier.ToString());

                ProcessScriptBase(mapping, writer);
            }
        }
 public string SerialiseReferenceMapping(TableReferenceMapping mapping)
 {
     return Serialise(writer => SerialiseReferenceMappingInternal(mapping, writer));
 }
        private void SerialiseReferenceMappingInternal(TableReferenceMapping mapping, XmlWriter writer)
        {
            if (mapping.FromTable == null)
                throw new ArgumentNullException("mapping", string.Format("mapping.FromTable cannot be null [{0}]", mapping.DisplayName));
            if (mapping.ToReference == null)
                throw new ArgumentNullException("mapping", string.Format("mapping.ToReference cannot be null [{0}]", mapping.DisplayName));

            WriterHelper document = new WriterHelper(writer);

            using (document.Element("TableReferenceMapping"))
            {
                writer.WriteElementString("FromTable", mapping.FromTable.Name);
                writer.WriteElementString("FromSchema", mapping.FromTable.Schema);
                writer.WriteElementString("ToReference", mapping.ToReference.Identifier.ToString());

                ProcessScriptBase(mapping, writer);
            }
        }
Exemple #8
0
 public string SerialiseReferenceMapping(TableReferenceMapping mapping)
 {
     return(Serialise(writer => SerialiseReferenceMappingInternal(mapping, writer)));
 }
 public static void TestMapping(TableReferenceMapping mapping, ITable table, Reference reference)
 {
     Assert.That(mapping.FromTable, Is.SameAs(table));
     Assert.That(mapping.ToReference, Is.SameAs(reference));
 }
 public static void TestMapping(TableReferenceMapping mapping, ITable table, Reference reference)
 {
     Assert.That(mapping.FromTable, Is.SameAs(table));
     Assert.That(mapping.ToReference, Is.SameAs(reference));
 }
Exemple #11
0
 public void SetUp()
 {
     mappingSet = new MappingSetImpl();
     mapping    = new TableReferenceMappingImpl();
 }
Exemple #12
0
        public void RemoveMapping(TableReferenceMapping mapping)
        {
            if (referenceMappings.Remove(mapping))
            {
                mapping.MappingSet = null;
            }

            CacheInvalid = true;
            RaisePropertyChanged("ReferenceMappings");
        }
Exemple #13
0
        public void AddMapping(TableReferenceMapping mapping)
        {
            if (referenceMappings.Contains(mapping))
                return;

            referenceMappings.Add(mapping);
            mapping.MappingSet = this;
            CacheInvalid = true;
            RaisePropertyChanged("ReferenceMappings");
        }
        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);
        }
        public void Setup()
        {
            mappingSet = new MappingSetImpl();

            table1 = new Table("Table1");
            var table2 = new Table("Table2");

            mapping3 = new MappingImpl { FromTable = table2 };
            refMapping1 = new TableReferenceMappingImpl { FromTable = table2, ToReference = new ReferenceImpl()};

            mappingSet.AddMapping(new MappingImpl { FromTable = table1 });
            mappingSet.AddMapping(new MappingImpl { FromTable = table1 });
            mappingSet.AddMapping(mapping3);
            mappingSet.AddMapping(refMapping1);
            mappingSet.AddMapping(new TableReferenceMappingImpl { FromTable = table1, ToReference = new ReferenceImpl()} );
        }