C#代码生成

编程入门 行业动态 更新时间:2024-10-27 01:30:02
本文介绍了C#代码生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在看为项目创建一个小班发生器。我一直在阅读有关的CodeDOM所以它创建类的语义并不似乎是一个问题,但我不确定哦如何产生最好的融入开发和部署过程。

  • 我应该如何触发类的创造?我已阅读应该是构建过程的一部分,我应该怎么做呢?

  • 应创建的类?我读这些文件不应该由手工编辑,从来没有签入到源控制。应我甚至担心这个,只是生成类到同一目录下生成引擎?

  • 解决方案

    你的问题的答案部分取决于您所产生的目的类。

    如果类作为一部分产生的发展的,他们应该生成文本文件和签入到您的SCM像任何其他类

    如果您的类在动态的运行的为你的系统的操作的一部分生成的,我不会用CodeDOM的所有。我会用反思。

    I am looking at creating a small class generator for a project. I have been reading about CodeDOM so it the semantics of creating the classes does not appear to be an issue, but am unsure oh how to best integrate the generation into the development and deployment process.

  • How should I trigger the creation of the classes? I have read it should be part of the build process, how should I do this?

  • Where should the classes be created? I read that the files should not be edited by hand, and never checked into source control. Should I even worry about this and just generate the classes into the same directory as the generator engine?

  • 解决方案

    The answers to your question depend partly on the purpose of your generated classes.

    If the classes are generated as a part of the development, they should be generated as text files and checked into your SCM like any other class.

    If your classes are generated dynamically at runtime as a part of the operation of your system, I wouldn't use the CodeDOM at all. I'd use Reflection.

    更多推荐

    C#代码生成

    本文发布于:2023-11-15 21:44:59,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1598220.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:代码

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!