Ejemplo n.º 1
0
        public override IList <ValidationResult> Execute(SchemaFile file)
        {
            var validationResults = Fragments
                                    .SelectMany(fragment => GetFieldPairReferences(file, fragment))
                                    .Where(pair => InvokesImplicitConversion(pair))
                                    .Select(pair => ToValidationResult(pair))
                                    .ToList();

            return(validationResults);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("/*\r\n * This code was generated by the CGbR generator on ");

            #line 13 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(DateTime.Now.ToString("d")));

            #line default
            #line hidden
            this.Write(". Any manual changes will be lost on the next build.\r\n * \r\n * For questions or bu" +
                       "g reports please refer to https://github.com/Toxantron/CGbR or contact the distr" +
                       "ibutor of the\r\n * 3rd party generator target.\r\n */\r\n");

            #line 18 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"

            foreach (var usedNamespace in Fragments.SelectMany(f => f.Usings).Distinct().OrderBy(f => f))
            {
            #line default
            #line hidden
                this.Write("using ");

            #line 22 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(usedNamespace));

            #line default
            #line hidden
                this.Write(";\r\n");

            #line 23 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            }


            #line default
            #line hidden
            this.Write("\r\nnamespace ");

            #line 27 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));

            #line default
            #line hidden
            this.Write("\r\n{\r\n    /// <summary>\r\n    /// Auto generated class by CGbR project\r\n    /// </s" +
                       "ummary>\r\n    ");

            #line 32 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Modifier.ToString("G").ToLower()));

            #line default
            #line hidden
            this.Write(" partial class ");

            #line 32 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(ClassName));

            #line default
            #line hidden

            #line 32 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(string.IsNullOrEmpty(BaseClasses) ? string.Empty : " : " + BaseClasses));

            #line default
            #line hidden
            this.Write("\r\n    {\r\n");

            #line 34 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"

            foreach (var fragment in Fragments)
            {
            #line default
            #line hidden
                this.Write("        #region ");

            #line 38 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(fragment.GeneratorName));

            #line default
            #line hidden
                this.Write("\r\n\r\n");

            #line 40 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(fragment.Code));

            #line default
            #line hidden
                this.Write("\r\n        \r\n        #endregion\r\n\r\n");

            #line 44 "C:\Users\Thomas\Documents\Development\CGbR\CGbR\ClassSkeleton.tt"
            }


            #line default
            #line hidden
            this.Write("    }\r\n}");
            return(this.GenerationEnvironment.ToString());
        }