コード例 #1
0
        /// <summary>
        /// Generate CSharp code from xml string
        /// </summary>
        /// <param name="xmlContent"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public string Generate(string xmlContent)
        {
            if (string.IsNullOrEmpty(xmlContent))
            {
                throw new ArgumentNullException();
            }
            MetaData = MetaDataReader.LoadMetaDataFromXml(xmlContent);
            var gen = PocoFactory.GeneratePoco(MetaData, Setting);

            CodeText  = gen.ToString();
            ClassList = gen.ClassList;
            Debug.WriteLine(CodeText);
            return(CodeText);
        }
コード例 #2
0
        public async Task <string> GenerateAsync(Uri uri, string user = "", string password = "")
        {
            //if (string.IsNullOrEmpty(uri.AbsoluteUri))
            //    throw new ArgumentNullException();
            //  MetaData = await MetaDataReader.LoadMetaDataHttpAsync(ServiceUri, User, Password);
            MetaData = await MetaDataReader.LoadMetaDataHttpAsync(uri, user, password);

            var gen = PocoFactory.GeneratePoco(MetaData, Setting);

            ClassList = gen.ClassList;
            CodeText  = gen.ToString();
            Debug.WriteLine(CodeText);
            return(CodeText);
        }