Inheritance: DataContextTemplateBase
コード例 #1
0
        /// <summary>
        /// Generates the code to build the typed data context.
        /// </summary>
        /// <param name="typeName">Name of the type.</param>
        /// <param name="namespace">The namespace.</param>
        /// <param name="model">The model.</param>
        /// <returns>The code to be compiled as a string.</returns>
        private static string GenerateCode(string typeName, string @namespace, IEnumerable <CloudTable> model)
        {
            // We use a T4-generated class as the template
            var codeGenerator = new DataContextTemplate();

            codeGenerator.Namespace = @namespace;
            codeGenerator.TypeName  = typeName;
            codeGenerator.Tables    = model;

            return(codeGenerator.TransformText());
        }
コード例 #2
0
        /// <summary>
        /// Generates the code to build the typed data context.
        /// </summary>
        /// <param name="typeName">Name of the type.</param>
        /// <param name="namespace">The namespace.</param>
        /// <param name="model">The model.</param>
        /// <returns>The code to be compiled as a string.</returns>
        private static string GenerateCode(string typeName, string @namespace, IEnumerable <CloudTable> model)
        {
            // We use a T4-generated class as the template
            var codeGenerator = new DataContextTemplate
            {
                Namespace = @namespace,
                TypeName  = typeName,
                Tables    = model
            };

            // As a workaround for compiling issues when referencing the driver DLL itself to
            // access the base ExtendedTableQuery class, the code will be used instead in the
            // dynamic assembly.
            var baseClass = ReadEmbeddedBaseClassCode();

            var sourceCode = baseClass + codeGenerator.TransformText();

            LINQPad.Util.Break();

            return(sourceCode);
        }
コード例 #3
0
        /// <summary>
        /// Generates the code to build the typed data context.
        /// </summary>
        /// <param name="typeName">Name of the type.</param>
        /// <param name="namespace">The namespace.</param>
        /// <param name="model">The model.</param>
        /// <returns>The code to be compiled as a string.</returns>
        private static string GenerateCode(string typeName, string @namespace, IEnumerable<CloudTable> model)
        {
            // We use a T4-generated class as the template
            var codeGenerator = new DataContextTemplate();

            codeGenerator.Namespace = @namespace;
            codeGenerator.TypeName = typeName;
            codeGenerator.Tables = model;

            return codeGenerator.TransformText();
        }