System.Collections.ListofTips System.Collections.ListofTips

June 1, 2008 June 1, 2008

Intento de Generación de Código con AjGenesis Attempted Generation Code AjGenesis

Filed under: Generación de Codigo — José Franco @ 2:39 pm Filed under: Code Generation - Jose Franco @ 2:39 pm

Estuve varios días alejado, porque estuve acostumbrándome a la metodología de trabajo, de desarrollo, y demás factores al nuevo cliente, y haciendo pruebas para cambiar un generador de código que tenían con CodeDom a AjGenesis. I was several days away, because I was accustomed to working methods, development, and other factors to the new customer, and testing to change a code generator that had to AjGenesis with CodeDom.

La Arquitectura que tenemos, no sé si llamarla “Arquitectura”, solo tenemos un ServiceLocator, que tenemos todas mapeadas las entidades de spring.net, con una implementación de Ado para cada una, así es posible en usarla en distintos motores. The architecture we have, I do not know whether to call "architecture", we have only one ServiceLocator, we mapped all entities spring.net with an implementation of Ado for each, it is possible to use different engines. Estas entidades son más un mapeo de la tabla, no posee ni conceptos de hijos, nietos ni nada similar, cosa que voy a intentar madurar a futuro, pero ya la próxima voy a estar implementando nhybernate. These entities are a mapping of the table, does not hold any notions of children, grandchildren or anything similar, which I will try to mature in the future, but I will next be implemented nhybernate.

http://swap.synnax.net/download.php?synx.5307-Alpha0.2.zip http://swap.synnax.net/download.php?synx.5307-Alpha0.2.zip

Una vez instalado, van a la carpeta C:\Projects\Tools (No modifiquen el path en la instalación) Once installed, go to C: \ Projects \ Tools (not change the path in the installation)


Ejecutamos: Run:


Nos abre nuestro gestor de proyectos We opened our project manager


Podemos agregar nuevas entidades a los existen, tanto la eliminación de Proyectos y entidades, se hace a mano por ahora. We can add new entities to exist, both projects and the removal of bodies by hand for now.

Generemos un nuevo proyecto Generate a new project


Ingresamos los datos Enter data


En directory, no generar directorios con espacios, lo mismo sucede con el NameSpace. In the directory, not to create directories with spaces, so does the namespace. La Connecion String, también tiene que ser válida, así se conecta a base de datos y mapea. The Connecion String, must also be valid, and connects to the database and maps.

Y el provider, en esta versión tiene implementadno Sql Server y Oracle (el tema que el template que deje es el que uso en el cliente, y hay ciertas referencias que no van a andar, pero modificando el helper ya estaria, prometo hacer un template neutro para la semana que viene) The provider, in this version has implementadno Sql Server and Oracle (the issue that the template is to stop the use in the client, and there are some references that are not going to walk, but would already be changing the helper, I promise to make a template neutral for next week)

Aceptamos, retornamos en la página anterior, y presionamos botón derecho sobre “WebCTC” (si nos basamos en los datos que ingrese anteriormente). Accepted, we return to the previous page, and press the right button on WebCTC "(if we rely on the data you enter above.)


Vamos a Ver Entidades, nos va a aparecer un listado vacio Let's See entities, we will see an empty list


Vamos a la opción de “Crear”, los literales están mal.. Go to the option to "Create", the literal badly .. ya que es una versión muy alfa.. since it is a very alpha ..


Nos aparece las tablas a mapear, yo voy a mapear un par de Tablas, y le indico que me elimine el prefijo “AG_” (Así me genera la class Contractor, en vez de Ag_contractor), clickeamos en “Generar”. Appears to map the tables, I'm going to map a couple of tables, and tells me that removing the prefix "AG_" (This class generates the Contractor me, instead of Ag_contractor), click "Generate".

Ya nos aparece en la lista de entidades We listed entities


Si hacen doble clic sobre los elementos les va a levantar el Xml If they do double-click on the items they will lift the Xml


Cerramos la ventana, volvemos a la ventana anterior We closed the window, return to previous window

Le doy en Generar código a CTC I Generate code to CTC



Abre una consola que ejecuta, el AjGenesis para la generación del código con mis entidades, y nant para compilar todo. Open a console that runs the AjGenesis to generate the code with my entities and Nant to compile everything. Si todo salió bien van a ver un Build Succeded. If everything went well you will see a Build Succeded.

Presionan una tecla, y les va a abrir la carpeta de generación: Push a button and they will open the folder generation:


En la carpeta Assemblys, están todas las dll’s generadas. In the folder Assemblys, all dll's are generated.
Default.build, es la task de Nant. Default.build is the task of Nant.
Como verán, tiene spring, genera una capa de dao, y una implementación de sqlserver y otra de oracle, aunque la de oracle no esta implementada… solo es una copia del Sql server. As you see, is spring, generating a layer of damage, and an implementation of sqlserver and Oracle, although Oracle is not implemented ... is only one copy of SQL Server.

En la capa de Services, ya mapea los ojos para spring In the layer Services, maps and eye for spring



Y también nos genero un proyecto de prueba llamado WebExample And we are also a gender test project called WebExample

Van A ver que me genera aspx ({ENTIDAD}_List.aspx) y llama al Service Locator I will see that generates aspx (() BODY _List.aspx) and calls the Locator Service


Es un ejemplo muy simple, pero nos deja ver si anda todo bien, levanto el proyecto y ejecuto alguno de los aspx It is a very simple example, but let us see if everything goes well, get up and run the project one of the aspx


Y Listo, esta andando… Ready And this walk ...

Al menos esto, yo ya le di uso práctico y lo use para un desarrollo, a medida que lo vaya usando, seguro que surgirán numerosos cambios At least this, I already gave practical use and use it for development, as it is using, you will come many changes



Share and Enjoy: Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • E-mail this story to a friend!
  • BarraPunto
  • blogmarks
  • co.mments
  • De.lirio.us
  • kick.ie
  • LinkedIn
  • Linkter
  • Live
  • Meneame
  • MyShare
  • Print this article!
  • TwitThis
  • YahooMyWeb
Bookmark and Share: Bookmark and Share:

No Comments » No Comments »

No comments yet. No comments yet.

RSS feed for comments on this post. TrackBack URL RSS feed for comments on this post. TrackBack URL

Leave a comment Leave a comment

Powered by WordPress Powered by WordPress