public static TableReferenceMapping GetMapping()
        {
            TableReferenceMapping mapping = new TableReferenceMappingImpl();
            mapping.FromTable = new Table("Table1");
            mapping.ToReference = new ReferenceImpl(new Guid("11111111-1111-1111-1111-111111111111"));
            mapping.MappingSet = new MappingSetImpl();

            return mapping;
        }
        public TableReferenceMapping DeserialiseReferenceMapping(XmlNode referenceMappingNode, IDatabase database, EntitySet set)
        {
            NodeProcessor         proc    = new NodeProcessor(referenceMappingNode);
            TableReferenceMapping mapping = new TableReferenceMappingImpl();
            string fromTableName          = proc.GetString("FromTable");
            string fromSchema             = proc.GetString("FromSchema");
            Guid   toReferenceIdentifier  = proc.GetGuid("ToReference");
            var    reference = set.References.FirstOrDefault(r => r.Identifier == toReferenceIdentifier);

            mapping.FromTable   = database.GetTable(fromTableName, fromSchema);
            mapping.ToReference = reference;
            ProcessScriptBase(mapping, referenceMappingNode);
            return(mapping);
        }
예제 #3
0
        public void To(ITable table)
        {
            RemoveOldMapping();

            if (table == null)
            {
                return;
            }

            TableReferenceMapping mapping = new TableReferenceMappingImpl()
            {
                FromTable = table, ToReference = reference
            };

            ms.AddMapping(mapping);
            ms.InvalidateCache();
        }
예제 #4
0
        public void To(ITable table)
        {
            RemoveOldMapping();

            if (table == null) return;

            TableReferenceMapping mapping = new TableReferenceMappingImpl() { FromTable = table, ToReference = reference };
            ms.AddMapping(mapping);
            ms.InvalidateCache();
        }
 public TableReferenceMapping DeserialiseReferenceMapping(XmlNode referenceMappingNode, IDatabase database, EntitySet set)
 {
     NodeProcessor proc = new NodeProcessor(referenceMappingNode);
     TableReferenceMapping mapping = new TableReferenceMappingImpl();
     string fromTableName = proc.GetString("FromTable");
     string fromSchema = proc.GetString("FromSchema");
     Guid toReferenceIdentifier = proc.GetGuid("ToReference");
     var reference = set.References.FirstOrDefault(r => r.Identifier == toReferenceIdentifier);
     mapping.FromTable = database.GetTable(fromTableName, fromSchema);
     mapping.ToReference = reference;
     ProcessScriptBase(mapping, referenceMappingNode);
     return mapping;
 }
        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);
        }