private void GenerateDataContext(EntityContext entityContext)
        {
            var directory = Options.Data.Context.Directory;
            var file      = entityContext.ContextClass + ".cs";
            var path      = Path.Combine(directory, file);

            _logger.LogInformation(File.Exists(path)
                ? "Updating data context class: {file}"
                : "Creating data context class: {file}", file);

            var template = new DataContextTemplate(entityContext, Options);

            template.WriteCode(path);
        }
Beispiel #2
0
 public override void Build(CompileBase compile, Foundation.Projects.ProjectDocument doc)
 {
     try
     {
         var serviceCompile = compile as ServiceCompile;
         foreach (var item in serviceCompile.Data.DataContexts.Values)
         {
             string result = new DataContextTemplate(item).TransformText();
             serviceCompile.GenerateCode("", item.ClassName, result);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("DataContextBuild:" + ex.ToString());
     }
 }