/// <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()); }
/// <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); }
/// <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(); }