Пример #1
0
        /// <summary>
        /// initalizes the custom mapping from assembly manifest stream
        /// </summary>
        private static void InitCustomMapping()
        {
            string resourceName = "customMapping.xml";
            // load from asm
            Assembly asm          = (typeof(TestServer)).Assembly;
            Stream   configStream = asm.GetManifestResourceStream(resourceName);

            if (configStream == null)
            {
                Console.WriteLine("custom mapper not loadable, {0} not found in assembly", resourceName);
                Environment.Exit(2);
            }
            try {
                CustomMapperRegistry reg = CustomMapperRegistry.GetSingleton();
                reg.AddMappingFromStream(configStream);
            } catch (Exception e) {
                Console.WriteLine("custom mapper not loadable, exception: {0}", e);
                Environment.Exit(2);
            }
        }
Пример #2
0
        public void SetupEnvironment()
        {
            // register the channel
            m_channel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_channel, false);

            // access COS nameing service
            CorbaInit     init        = CorbaInit.GetInit();
            NamingContext nameService = init.GetNameService("localhost", 1050);

            NameComponent[] name = new NameComponent[] { new NameComponent("testPlugin", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);

            try {
                CustomMapperRegistry reg = CustomMapperRegistry.GetSingleton();
                reg.AddMappingsFromFile(new FileInfo("customMapping.xml"));
                reg.AddMappingsFromFile(new FileInfo("customMappingTest.xml"));
            } catch (Exception e) {
                Console.WriteLine("custom mapper not loadable: " + e);
                throw e;
            }
        }