static void Main(string[] args) { try { args = args.Length > 0 ? args : new[] { "-GenModel", @"D:\Lat Projects\WL_Main\Latitude.WhiteLabel.Models\bin\Release\Latitude.WhiteLabel.Models.dll", "Latitude.WhiteLabel.Models", @"D:\Lat Projects\WL_Main\Latitude.WhiteLabel.Models\obj\Debug\Temp", "tickbox.web.shared.dto", @"D:\Lat Projects\WL_Main\Latitude.WhiteLabel.Models\obj\Debug\TessellTemp", "latitude.gwt.tessellshared.tmodel", }; // : new[] // { // "-GenWebApi", // @"D:\Lat Projects\WL_SEO4SME\Latitude.SeoPortal.Ui\war\bin\Latitude.SeoPortal.Ui.dll", // "Latitude.SeoPortal.Ui.Controllers", // @"D:\Lat Projects\WL_SEO4SME\\latitude.seoportal.ui\src\latitude\seoportal\ui\client\remotelogic", // "latitude.seoportal.ui.client.remotelogic", // "Latitude.WhiteLabel.Models", // "tickbox.web.shared.dto" // }; if (args[0] == "-GenModel") { ModelGenerator.GenModel(args); } else if (args[0] == "-GenWebApi") { WebApiGenerator.GenGwt(args); } else { throw new Exception("Unknown generation type: " + args[0]); } } catch (ReflectionTypeLoadException rtle) { Console.WriteLine(rtle.Message); foreach (var e in rtle.LoaderExceptions) { Console.WriteLine(e.Message); } //Console.ReadLine(); throw; } catch (Exception e) { // Debugger.Break(); Console.WriteLine(e.Message); //Console.ReadLine(); throw; } }
/// <summary> /// Generates for controllers. /// </summary> /// <param name="types">The types.</param> /// <param name="settings">The settings.</param> /// <param name="excludedMethodName">Name of the excluded method.</param> /// <returns></returns> public static string GenerateForControllers(IEnumerable <Type> types, GeneratorSettings settings, params string[] excludedMethodName) { var generator = new WebApiGenerator(settings) { ExcludedMethodsName = new HashSet <string>(excludedMethodName) }; return(generator.GenerateForControllers(types)); }
public override ICollection <Assembly> GetAssemblies() { ICollection <Assembly> baseAssemblies = base.GetAssemblies(); List <Assembly> assemblies = new List <Assembly>(baseAssemblies); // Add our controller library assembly try { WebApiGenerator gen = new WebApiGenerator("DynamicWebApiController"); Assembly onTheFly = gen.CreateDll(); if (onTheFly != null) { assemblies.Add(onTheFly); } } catch { // We ignore errors and just continue } return(assemblies); }