예제 #1
0
        public static XRoadExtensionConfig GetConfiguration(Configuration configuration)
        {
            XRoadExtensionConfig config = null;

            if (configuration != null)
            {
                config = configuration.GetSection("xroadExtension") as XRoadExtensionConfig;
            }

            if (config != null)
            {
                return(config);
            }

            config = ConfigurationManager.GetSection("xroadExtension") as XRoadExtensionConfig;
            if (config != null)
            {
                return(config);
            }

            var configFile = GetCommandLineConfigFile();

            if (configFile != null && File.Exists(configFile))
            {
                var c = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap {
                    ExeConfigFilename = configFile
                }, ConfigurationUserLevel.None);
                if (c != null)
                {
                    config = c.GetSection("xroadExtension") as XRoadExtensionConfig;
                }
            }

            return(config);
        }
        public void GenerateContract(ServiceContractGenerationContext context)
        {
            var configuration = XRoadExtensionConfig.GetConfiguration(context.ServiceContractGenerator.Configuration);

            string doc = null;

            if (documentation.TryGetValue(configuration.CommentLanguage, out doc))
            {
                context.ContractType.Comments.Add(new CodeCommentStatement("<summary>", true));
                context.ContractType.Comments.Add(new CodeCommentStatement(doc, true));
                context.ContractType.Comments.Add(new CodeCommentStatement("</summary>", true));
            }
        }