Exemple #1
0
        public void ParseTwoForeignKeyMapping()
        {
            string mappingFile = @"..\..\..\Ugly.Data\Mapping\TwoForeignKeyMap.Generated.cs";

            var result = MappingParser.Parse(mappingFile);

            Assert.IsNotNull(result);
        }
Exemple #2
0
        public void ParseManyToManyMapping()
        {
            string mappingFile = @"..\..\..\Tracker.Core\Mapping\RoleMap.Generated.cs";

            var result = MappingParser.Parse(mappingFile);

            Assert.IsNotNull(result);
        }
        // Parses the mapping protocol uri that specifies the namespace and assembly
        // referenced by the uri.
        private void HandleMappingProtocol(
                string mappingUri)
        {
            MappingParser parser = new MappingParser(mappingUri, MappingProtocol.Length);
            if (!parser.Parse())
                ThrowException(SRID.ParserMappingUriInvalid, mappingUri);

            // Always set up the mapping for this in the XamlTypeMapper immediately upon seeing the
            // mapping URI, since it can be needed in the very next read operation and must be in place.
            if (!XamlTypeMapper.PITable.Contains(mappingUri))
            {
                string assemblyName = parser.Assembly;
                bool isLocalAssembly = assemblyName == null || assemblyName.Length < 1;
#if PBTCOMPILER
                if (isLocalAssembly)
                    assemblyName = ReflectionHelper.LocalAssemblyName;
#endif
                ClrNamespaceAssemblyPair usingData = new ClrNamespaceAssemblyPair(parser.Namespace, assemblyName);

#if PBTCOMPILER
                usingData.LocalAssembly = isLocalAssembly;
#endif

                XamlTypeMapper.PITable.Add(mappingUri, usingData);
            }

            // Generate a pseudo mapping instruction in the BAML from the URI
            WritePI(mappingUri, parser.Namespace, parser.Assembly);
        }
Exemple #4
0
        public override void Execute(string input)
        {
            MappingParser mappingParser = new MappingParser(_database);

            mappingParser.ParseMappingFromOrderFile(input);
        }